Пример #1
0
        async Task RunBotAsync()
        {
            _sql      = new sqlConnector();
            _client   = new DiscordSocketClient();
            _commands = new CommandService();
            _services = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton(_commands)
                        .BuildServiceProvider();

            _sql.Setup();

            var botToken = ConfigurationManager.AppSettings["token"];

            _client.Log += Log;

            await RegisterCommandsAsync();

            await _client.LoginAsync(TokenType.Bot, botToken);

            await _client.StartAsync();

            await Task.Delay(-1);
        }