Пример #1
0
 public void Check(ReceivedMessage message)
 {
     if (this.Bot != null)
     {
         if (!(this.CanBeMuted && !this.Bot.CanSpeak) && Condition.Invoke(message))
         {
             try
             {
                 Thread.Sleep(150);
                 Response.Invoke(message);
             }
             catch (Exception)
             {
                 this.Bot.SendMessage("F**k! Something went wrong, tell Master Alckie to fix this shit.");
             }
         }
     }
 }
Пример #2
0
        public void Check(ReceivedMessage message)
        {
            if (this.Bot != null)
            {
                if (!(this.CanBeMuted && !this.Bot.CanSpeak) && Condition.Invoke(message))
                {
                    try
                    {
                        var userSpamCounter = this.Bot.GetUserSpamCounter(message.sender_id, this.SpamCounterType);
                        if (userSpamCounter.Counter < SpamCounter.DEFAULT_MAX_SPAM_COUNTER)
                        {
                            userSpamCounter.HasBeenWarned = false;

                            Thread.Sleep(150);
                            Response.Invoke(message);

                            this.IncreaseAntiSpamCounter(userSpamCounter);
                        }
                        else
                        {
                            this.AntiSpamResponse.Invoke(message);
                        }
                    }
                    catch (Exception)
                    {
                        this.Bot.SendMessage("F**k! Something went wrong, tell Master Alckie to fix this shit.");
                    }
                }
            }
        }
Пример #3
0
 public void CheckMessage(ReceivedMessage message)
 {
     if (this.Bot.IsBeingADouche && Bots.TestChatBot != null)
     {
         Bots.TestChatBot.SendMessage(message.ToJsonString());
     }
     foreach (var command in this.Commands)
     {
         try
         {
             command.Check(message);
         }
         catch (Exception ex)
         {
             Bots.TestChatBot.SendMessage(ex.ToString());
             //Idc, just keep looping through the commands if something goes wrong.
         }
     }
 }