Cant access discord message C# discord.net

Viewed 25

I am trying to access the message from discord via HandleCommand and Socketmessage, but, they cant pass the if check for.

    public async Task RegisterCommandAsync()
    {
        _client.MessageReceived += HandleCommandAsync;
        await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services);
    }

    private async Task HandleCommandAsync(SocketMessage arg)
    {
        var message = arg as SocketUserMessage;
        if (message.Author.IsBot) return;

        int argPos = 1;

        if (message.HasCharPrefix('!', ref argPos) || message.HasCharPrefix('?', ref argPos))
        {
            Console.WriteLine("win");
        }
    }
}
0 Answers
Related