I am trying to make a discord bot using discord.py and I tried creating two commands but when I tried sending /hello
then it just don’t responds, here’s the code:
import discord
import asyncio
import ast
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
intents.message_content = True
bot = commands.Bot(command_prefix='?', intents=intents)
@bot.event
async def on_ready():
print(f'logged in baby {bot.user}')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if 'nigg' in message.content or 'wigg' in message.content:
author = message.author
guild = message.guild
await author.add_roles(discord.utils.get(guild.roles, name='Racist'))
await message.delete()
@bot.command()
async def calculate(ctx, *, expression: str):
await ctx.send(f'{expression} = {eval(expression)}')
@bot.command()
async def hello(ctx):
print('hi')
await ctx.send('hello guys')
bot.run('MTIzNTE4NTY2ODY5NTUyNzQ4NA.G83pGo.BFsFrT_smydwBr-X5a_knRWPHjFXnsSAKEs43U')
And yes the bot is running while I typed that command.
I tried using @bot.command()
and expected to respond but no it just do nothing.
New contributor
notanerd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.