#Currently my message.content is always coming out empty. So when i check for the prefix it is null.

1 messages · Page 1 of 1 (latest)

carmine crypt
#

Here is the code

 /// <summary>
        /// Handle Command Async
        /// </summary>
        private async Task HandleCommandAsync(SocketMessage arg)
        {
            try
            {
                CheckForNewGuilds();

                if (arg is SocketUserMessage && arg != null)
                {
                    DiscordWorker.Log("MESSAGE FOUND", LogType.Info);
                    try
                    {
                        var message = arg as SocketUserMessage;

                        var textchannel = arg.Channel as SocketTextChannel;

                        if (textchannel != null)
                        {
                            ulong guildid = textchannel.Guild.Id;

                            int argPos = 0;

                            if (m_GuildsPrefix.ContainsKey(guildid))
                            {
                                DiscordWorker.Log($"Message: + {message.Content}", LogType.Info); // *******EMPTY******
                                // This will always be true now.
                                bool doesNotHaveCharPrefix = !(message.HasCharPrefix(m_GuildsPrefix[guildid], ref argPos));
                                bool hasUserentioned = message.HasMentionPrefix(m_Client.CurrentUser, ref argPos);
                                bool isBot = message.Author.IsBot;

                                DiscordWorker.Log($"Does Not Have Char Prefix {doesNotHaveCharPrefix}", LogType.Info);
                                DiscordWorker.Log($"Has Mention prefix {hasUserentioned}", LogType.Info);
                                DiscordWorker.Log($"Is Bot {isBot}", LogType.Info);

                                if (doesNotHaveCharPrefix || hasUserentioned || isBot)
                                    return;

                                var context = new SocketCommandContext(m_Client, message);



shut swift
#

Do you have MessageIntent enabled?

carmine crypt
#

I do not know if you mean this

#

@shut swift

shut swift
#

You need to enable it in code too. GatewayIntents = GatewayIntents.Message or something like this

south atlas
#

GatewayIntents = GatewayIntents.AllUnpriviliged | GatewayIntents.MessageContent

carmine crypt
#

excellent

#

i iwll try now

#

@south atlas why the first one

south atlas
#

Don't specifically mention anyone pls
Ppl will help you as they have free time

____________

Well
It's not really required but without those intents you wouldn't be able to get any guild, channel, etc (unless you manually do REST calls)

carmine crypt
#

thats interesting

#

thank you

#

Solved! Intents were not setup with the API upgrade! Cheers guys

south atlas
#

If you know exactly what are you doing and what you need you can specifically choose intents but all unprivileged is just better for beginners / who never worked with intents