DeSinc / SallyBot

AI Chatbot coded in Discord.net C#
MIT License
299 stars 51 forks source link

"Missing required gateway intent" When it's enabled #42

Closed FusionBrah closed 2 months ago

FusionBrah commented 2 months ago

G'day, When I am running the bot I am getting the following output in the console:

|12/06/2024 1:16:19 PM - Gateway| System.InvalidOperationException: Missing required gateway intent GuildMembers in order to execute this operation.
   at Discord.WebSocket.DiscordSocketClient.EnsureGatewayIntent(GatewayIntents intents)
   at Discord.WebSocket.DiscordSocketClient.DownloadUsersAsync(IEnumerable`1 guilds)
   at Discord.WebSocket.DiscordSocketClient.<ProcessMessageAsync>b__158_0(Task x)

I have confirmed that the correct intent's are enabled on the application on the Discord Dev portal.

Screenshot 2024-06-12 at 1 35 52 PM

Cheers mate.

DeSinc commented 2 months ago

This error can for the moment be safely ignored and doesn't break or affect anything in the bot, however I will take a look at correcting this as it is probably just a quick thing to add to my code. I'll check it out

FusionBrah commented 2 months ago

Will this affect if the bot can @ reply to someones message?

DeSinc commented 2 months ago

Will this affect if the bot can @ reply to someones message?

No all of that has been working fine. (Edit: I deliberately set the bot to either not ping for replies or to just not reply at all because it got confused with it in the past, replying to someone 2 messages ago but hitting reply on the last person to type)

I've just put in a line that fixes this by adding the GuildMembers intent at initialisation. I'm not sure if anything actually uses it, but it might. I had a think about it and it might have affected its ability to see name changes like if you change the bot's name on discord for example it may not update in the program, but I'm not sure as I haven't tested it.

In either case it will all be fixed now, but nothing really should have changed for the most part.