I'm using Discord.py and replit to write a bot. I'm starting off super simple, I simply want my bot to respond to my hello. Here is my code Here is the console
I have troubleshooted in the neighborhood of 7 or 8 errors with this code (I know it's sad that 20 lines of code gave me this much trouble) and gotten all of that fixed. So now that the console isn't showing any errors, I'm confused why nothing is happening when I type in $hello to my bot on discord.
Other info: My discord bot does go online when I hit run, which tells me the token stuff is working. I ran into problems on line 4 which was a whole "Intents" fiasco, this is my first time using the Intents keyword and so I would assume the issue lies somewhere in there. Other idea: This may have something to do with the console saying "Shard ID None"?
Short Answer
Give the bot the
message_content
intent in the constructor and enable it in the Developer DashboardDetailed Answer
Make a variable called
intents = discord.Intents.default()
.After that set
intents.message_content = True
and pass it to yourdiscord.Client
constrcutor (intents=intents
instead ofintents=discord.Intents.default()
).Now go to the Discord Developer Dashboard, open your application, head to "Bot" and enable the "Message Content Intent" in the "Privileged Gateway Intents" section.
Make sure this is enabled!