Async c#

Status
Not open for further replies.

harambe

Donator
Dec 3, 2018
154
115
Hello! I am attempting to create a discord bot within Visual Studio, so far so good, however, it is not allowing me to use

AddModulesAsync

Search await Commands.AddModulesAsync(Assembly.GetEntryAssembly());

Here's what I'm talking about,

C#:
using System;
using System.Reflection;
using System.Threading.Tasks;

using Discord;
using Discord.Commands;
using Discord.WebSocket;

namespace Pixeled
{
    class Program
    {
        private DiscordSocketClient Client;
        private CommandService Commands;

        static void Main(string[] args)
        => new Program().MainAsync().GetAwaiter().GetResult();

        private async Task MainAsync()
        {
            Client = new DiscordSocketClient(new DiscordSocketConfig
            {
                LogLevel = LogSeverity.Debug
            });

            // TEST
            Commands = new CommandService(new CommandServiceConfig
            {
                CaseSensitiveCommands = true,
                DefaultRunMode = RunMode.Async,
                LogLevel = LogSeverity.Debug
            });

            Client.MessageReceived += Client_MessageReceived;
            await Commands.AddModulesAsync(Assembly.GetEntryAssembly());

            Client.Ready += Client_Ready;
            Client.Log += Client_Log;

            string Token = "";
            await Client.LoginAsync(TokenType.Bot, Token);
        }

        private Task Client_Log(LogMessage arg)
        {
            throw new NotImplementedException();
        }

        private Task Client_Ready()
        {
            throw new NotImplementedException();
        }

        private Task Client_MessageReceived(SocketMessage arg)
        {
            throw new NotImplementedException();
        }
    }
}

Any ideas on why? VS quickhelp is not being very helpful.
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top