Ejemplo n.º 1
0
        private static async Task MainAsync()
        {
            using (var client = new DiscordSocketClient())
            {
                var config = await ConfigProvider.GetConfigAsync().ConfigureAwait(false);

                if (config == null)
                {
                    LoggingService.LogError("Could not start bot. "
                                            + $"'{ConfigProvider.FilePath()}' does not exist.");
                    return;
                }

                client.Log             += LoggingService.Log;
                client.MessageReceived += MessageHandler.MessageRecieved;

                await client.LoginAsync(Discord.TokenType.Bot, config.Token).ConfigureAwait(false);

                await client.StartAsync().ConfigureAwait(false);

                await Task.Delay(-1);
            }
        }