"Message Content Intent is missing"

Question:
Could anyone tell me why my code is giving an error? I don’t know programming and I’m trying to make my own bot on discord and it’s going wrong. I made it with AI and tried to modify it a few times, and the error “Message Content Intent is missing” appears.
Repl link:
https://replit.com/@joaopedro200911/Nubank?v=1

code snippet

Hey @joaopedro200911!

The error you’re getting means your Discord bot has not been approved for the Message Content Privileged Intent or you have not enabled it in the Discord Developer Portal (where you created your bot).

Go to your application page, click the Bot section and make sure Message Content Intent is enabled like below:

(If you feel like my answer has solved your question, feel free to mark it as the solution by pressing the image button!)

3 Likes

Thanks for the answer!
I did this but the error keeps appearing.

You did not set up the intents for your bot.

You need to set up which intents do you want to use.

So you need to update your code:

import discord
from discord.ext import commands

# You define the necessary intents
intents = discord.Intents.default()
intents.messages = True  # For example, this line enable the message content intent

# And don't forget to include inside your commands.
bot = commands.Bot(command_prefix='!', intents=intents)

What intents are needed?

The intents that are necessary for your bot can only be dictated by yourself. Each attribute in the Intents class documents what events it corresponds to and what kind of cache it enables.

https://discordpy.readthedocs.io/en/latest/intents.html

3 Likes

Check out my discord bot’s code. On line 67-69 there are these lines of code:

intents = discord.Intents.default()
intents.message_content = True #THIS IS WHAT YOU WANT
client = discord.Client(intents-intents)

If you do not have these, that would probably give you the error.

Hope this helps!

1 Like

Thank you very much for the answers! Sorry for the delay in responding. I changed the code and managed to succeed, thank you very much for the answers ; ) @MilesWK @WindLother @haroon

this code doesn’t even work :l

discord.Client(intents=intents)
2 Likes

Just fix the

discord.Client(intents-intents)

to

discord.Client(intents=intents)

I am glad I could help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.