Exemplo n.º 1
0
        private async Task MessageHandler(SocketMessage message)
        {
            char messagePrefix = message.Content[0];

            if (Bots.botsPrefixes.Exists(s => s == messagePrefix))
            {
                Console.WriteLine($"{DateTime.Now} -- Command: {message.Content} from user {message.Author.Username}#{message.Author.Id}");

                Bots.BotType botType = Bots.GetBotType(messagePrefix);

                string command = message.Content.Substring(1).ToLower().Trim();

                try
                {
                    switch (botType)
                    {
                    case Bots.BotType.CamBot:
                        await CamBot.CamBotCommandsAsync(command, message);

                        break;

                    case Bots.BotType.CleanerBot:
                        await CleanerBot.DeleteLastMessages(command, message);

                        break;

                    case Bots.BotType.MusicBot:
                        break;

                    case Bots.BotType.ChanceCalculateBot:
                        await CalculateChanceBot.HandleComandAsync(command, message);

                        break;

                    case Bots.BotType.Unknown:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Helper.ConsoleWriteExceptionInfo(ex);
                }
            }
        }
Exemplo n.º 2
0
 private Task ClientReady()
 {
     CalculateChanceBot.DeserializeDictionary();
     return(Task.CompletedTask);
 }