Example #1
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            Log.Debug("Initializing command handler");
            await _discordHandler.InitializeAsync();

            Log.Information("Logging in...");
            await _discord.LoginAsync(TokenType.Bot, _config["Bot:Token"]);

            await _discord.StartAsync();

            if (!string.IsNullOrWhiteSpace(_config["Bot:Status"]))
            {
                await _discord.SetStatusAsync(UserStatus.AFK);

                await _discord.SetGameAsync(_config["Bot:Status"]);
            }

            await _busControl.StartAsync(cancellationToken : cancellationToken);

            Log.Information("Bot started");
        }