#my bot can't read messages (except its own)

1 messages · Page 1 of 1 (latest)

scarlet olive
#

The command I marked is the one that is not working, in my last check, the command should send "your id is XYZ" but the bot is not able to read any message other than its own, if it is from others, it can only know that they sent it, but not what they said.

I imagine the error is on the server, but if so, I couldn't solve it.

tulip dome
#

ah well which tag to send

#

!!messagecontent

stiff harborBOT
#

Available tags:

  • messagecontentintent (alias: mci)
  • messagecontentintentdebug (alias: mcid)

Invoking using !!<tag>.

tulip dome
#

ugh

#

!!mci

stiff harborBOT
#

Why is message.content None or empty?
Official docs: https://docs.nextcord.dev/en/latest/intents.html#what-happened-to-my-prefix-commands
Content fields: .content, .embeds, .attachments, .components
Discord recently introduced another intent to annoy everyone limit the usage of message contents for bots. You now need to explicitly enable this intent (message_content) to get the "Content fields"

How to enable it?
It's like how you enable the members or presences intents.
You need to enable it on the portal! and in code:

from nextcord import Intents

# Using Intents.all()
# you don't need worry about this.

# Using Intent.default()
# this can also be your existing instance of Intents.
my_intents = Intents.default()
my_intents.message_content = True

# Never specified intents
# we recommend constructing an Intents object with the intents you need.
# Something like this:
# my_intents = Intents(messages=True, message_content=True, guilds=True)
# that will enable the message intent and guilds because that is required for text commands.

# using it
bot = commands.Bot(..., intents=my_intents)

I don't want to enable it!
k. You don't need to, you can still get the "Content fields" from messages in dms, where your bot is mentioned in and messages from your bot.

but I use slash commands?
Good choice! You do not need this intent for slash commands, it is required for text commands.

tulip dome
#

i see you do have it enabled

#

question also in developer portal?

#

!!mcid

stiff harborBOT
#

So you enabled the message_content intent but commands are still not working?
Common reasons for that are the following:

1. You did not read the tag above and instead copy-pasted the code or didn't look at it.
Please actually read the code and comments with it to solve this.
2. You misspelled the intents= kwarg in commands.Bot().
3. You assumed the messages intent is the same thing.
It's not, messages intent is to get messages at all and is enabled by default, message_content controls the following fields on the Message object: .content, .embeds, .attachments, .components.

tulip dome
#

ah there you go

#

message_content instead of messages

scarlet olive
#

ty

#

Give me a few minutes and I'll tell you if I managed it.

tulip dome
#

what

#

kwargs is keyword argument

scarlet olive
#

a

#

In the developer portal, I already activated it, the only thing that is deactivated is two-factor authorization, or something like that.

#

and I had a problem along the way. I'm trying to find a way.

torn flower
#

pip3 uninstall discord.py like it says

scarlet olive
#

I uninstalled it, I'm fixing the code that has things that depend on discord.py