0
votes

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

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

1
stackoverflow.com/help/how-to-ask is a great guide on how to ask a good question. Specifically stackoverflow.com/help/minimal-reproducible-example and how to show your code, data, and what is going wrong.Paul Brennan

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().