Ejemplo n.º 1
0
        public async Task StartAsync(string[] args)
        {
            try
            {
                FirstStart = Configuration.EnsureExists();
                Learning.EnsureExists();

                ClientInstance = new DiscordSocketClient(new DiscordSocketConfig()
                {
                    LogLevel         = LogSeverity.Verbose,
                    MessageCacheSize = 1000,
                    DefaultRetryMode = RetryMode.AlwaysFail
                });

                ClientInstance.Log             += (l) => Console.Out.WriteLineAsync(l.ToString());
                ClientInstance.MessageReceived += async(o) => await HandleMessage(new SocketCommandContext(ClientInstance, o as SocketUserMessage));

                ClientInstance.ReactionAdded += async(a, i, o) => await HandleReaction(o);

                ClientInstance.Ready += HandleReady;

                await ClientInstance.LoginAsync(TokenType.Bot, Configuration.Load().Token);

                await ClientInstance.StartAsync();

                await ClientInstance.SetGameAsync("Stuff, prob memes");

                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                await Task.Delay(-1);
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
        }