I’m having trouble with my Discord bot. It works perfectly when I send messages in direct messages, but completely ignores any messages sent in server channels. The bot seems to be online and connected, but my debug print statements show it’s not even receiving messages from servers. I’ve double-checked all the permissions and even tried creating a new bot and testing in different servers, but the issue persists.
Had the exact same issue a few months back - drove me crazy for hours. It’s definitely the privileged intents system Discord uses. The previous answer mentioned message content intent, but there’s another step people miss. After you enable message_content = True in your code and toggle it in the Developer Portal, regenerate your bot token. Discord caches old permissions with existing tokens sometimes. Also check if your bot has “Read Messages” and “Send Messages” permissions in the channels you’re testing. Even with correct intents, channel permission overrides can still block your bot from seeing messages.
Your intent configuration is incorrect. You’re currently using bot_intents.messages = True, but this doesn’t enable message content intent. Discord updated their API, requiring explicit permission for bots to read messages in servers. Adjust your code as follows: initialize bot_intents with discord.Intents.default(), then set bot_intents.message_content = True. Additionally, ensure that the “Message Content Intent” is activated in your bot’s settings on the Discord Developer Portal under the Bot section. Without this enabled, your bot will only respond to DMs and not messages from server channels.
check your discord dev portal settings - you need the message content intent enabled both there and in your code. i had this same issue last week cuz i forgot to hit save after enabling it in the portal. also try generating a fresh invite link with message content permissions to be safe.