This is my first time making a discord bot. I've followed every step of the tutorial but my bot doesnt react to the !test command. I do see the bot in the discord server. please help
0
votes
1 Answers
1
votes
Firstly, on line 15, your if statement for if(message.content.startswith(!test):
is place after the return. The bot will never reach those lines. You will have to move the indent back (indents in python are annoying).
if message.author == client.user:
return
if message.content.startswith('!test'):
await message.channel.send("Hello!")
await client.process_commands(message)
Secondly, await client.process_commands(message)
only works with a command client and does not work with the base discord.Client(). The client would have to to be something like
from discord.ext import commands
client = commands.Bot(command_prefix="!")
See What are the differences between Bot and Client? for the difference between discord.Client() and commands.Bot().