0

Hello I am creating a discord bot i was trying to add single command but bot doesn't respond to any commands

something like

Bot = commands.Bot(command_prefix="!")
@Bot.commands()
async def ping():
    print("Pong!")

this thing should respond when I type !ping in to discord client it should print pong in to terminal but nothing nothing at all I have tried Bot.add_command(ping) but it says command it's aleady registered i have no idea..

thenist
  • 25
  • 1
  • 8
  • Do you have an `on_message` event? https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working – Patrick Haugh Oct 26 '19 at 16:01
  • Does this answer your question? [Why does on\_message stop commands from working?](https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working) – Axisnix Oct 30 '19 at 11:05

1 Answers1

0

From what I've read from the discord.py docs you should code it like this:

Bot = commands.Bot(command_prefix="!")

@Bot.commands() 
async def ping(ctx):
    ctx.send("Pong!")

When you use 'print' you print the answer on your idle terminal. 'ctx.send' print the answer on discord chat. And every function on discord.py needs and argument.