Exemplo n.º 1
0
        /*
         *
         *  if commandList contains the command they typed...
         *      ...is .enabled? if FALSE, let them know and return
         *      ...is
         *
         */
        async void Handle(MessageCreateEventArgs e)
        {
            //Core commands
            //too complic8ed??
            switch (e.Message.Content)
            {
            case ".save":
                SaveModules();
                await e.Channel.SendMessageAsync("Saved");

                break;

            case ".load":
                LoadModules();
                await e.Channel.SendMessageAsync("Loaded");

                break;

            default:
                Console.WriteLine(e.Message.Content);
                if (e.Author.Id == discord.CurrentUser.Id && !e.Message.Content.StartsWith(".as"))
                {
                    return;
                }
                try {
                    await Task.Run(() => {
                        lake.Handle(e.Message);
                    });
                } catch (Exception ex) {
                    await e.Channel.SendMessageAsync($"Damn, you got me there, {e.Author.Mention}. Says here that \"{ex.Message}\". I don't know what that means, but uh oh, I guess. I'll just wait here until someone comes to fix me.");

                    SaveModules();
                    throw ex;
                }
                break;
            }
        }