#Text-Commands are always returning false using default template

1 messages ยท Page 1 of 1 (latest)

solar turtle
#

Using the default provided template here https://discordnet.dev/guides/text_commands/intro.html it's failing the if statement check, instantly on the HasCharPrefix check. In the Discord server I sent !hello, yet as you can see in the screenshot it runs right over the if statement into the return. You can see the debug state for the message object in screenshot. Not really sure what's changed since this used to work, I think. ๐Ÿ™‚

Any help or tips would be appreciated. ๐Ÿ™‚

granite birch
#

you need to enable MessageContent intent

solar turtle
granite birch
#

did you enable it in socket config too?

solar turtle
#

I practically copy/pasted the template.

#

Cannot see anything related in the Working with Text-based Commands to Socket Configuration

stable umbra
#

He means DiscordSocketConfig, you need to add it to your GatewayIntents flags

solar turtle
#

I think I got it

#

Or not.

var config = new DiscordSocketConfig
        {
            GatewayIntents = GatewayIntents.MessageContent
        };
        _client = new DiscordSocketClient(config);

added this now the MessageReceived event doesn't fire at all ๐Ÿ˜„

granite birch
#

GatewayIntents = GatewayIntents.AllUnpriviliged | GatewayIntents.MessageContent

solar turtle
#

Same problem with the above.

granite birch
#

make sure you use this instance of socket client

#

also you could look at the sample

solar turtle
#

Okay, so I took that project, replacing the token and started it now the bot won't connect to Discord. ๐Ÿ˜„

#

21:44:51 Gateway Discord.Net.HttpException: The server responded with error 401: 401: Unauthorized

#

I think I see what it is, one sec

#

yep

#

Stupid mistake ๐Ÿ‘