#Bot Command work only on DM but not Server

1 messages · Page 1 of 1 (latest)

random girder
#

Did you enable the Message Content Intent in the developer portal and added it to your clients scope on connecting to the gateway?

old plinth
#

I gave bot Administrator Permission and Checked bot and application.commands in Scopes on Developper portal

random girder
#

Before you start your client, you need to add a DiscordSocketConfig with the appropriate intent configured:

var config = new DiscordSocketConfig
{
    GatewayIntents = GatewayIntents.Guilds |
                     GatewayIntents.GuildMessages |
                     GatewayIntents.DirectMessages
};

var client = new DiscordSocketClient(config);

Also in the dev portal you need to activate this intent:

old plinth
#

I added the GatewayIntent in the DiscordSocketConfig

            client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Debug,

                GatewayIntents = GatewayIntents.Guilds |
                     GatewayIntents.GuildMessages |
                     GatewayIntents.DirectMessages
            });

But still the same issue

#

The runtime Console does recognize a message sent in the server but doesn't executing the command, but will if I sent it through dm to the Bot

random girder
#

hmm, I‘m on mobile .. so can’t really look it up. But if there also a MessageContent value within the GatewayIntents enum? Add that one too then

old plinth
#

I added the Gateway.MessageContent and now it works ! 🥳

#

thx for quick reply... I was really lost from looking all guides