Beispiel #1
0
        void AdminCommands(OnMessageReceivedArgs e)
        {
            if (e.ChatMessage.IsBroadcaster || e.ChatMessage.Username.ToLower().Equals("azatkzn"))
            {
                switch (e.ChatMessage.Message.ToLower())
                {
                case "!shopchange":
                    if (isOn)
                    {
                        ShopAction.ChangeCars(e, this);
                    }
                    break;

                case "!on":
                    isOn = true;
                    this.SendMessage(e.ChatMessage.Channel, "Бот включен!!!");
                    break;

                case "!off":
                    isOn          = false;
                    groupRaceIsOn = false;
                    this.SendMessage(e.ChatMessage.Channel, "Бот выключен!!!");
                    break;

                case "!racestart":
                    if (groupRaceIsOn)
                    {
                        return;
                    }
                    groupRaceIsOn = true;
                    this.GroupRaceControl(e.ChatMessage.Channel);
                    break;

                case "!kill":
                    Logger.LogInfo("!kill - System.Environment.FailFast()");
                    System.Environment.FailFast("!kill");
                    this.CloseNotFinishedGroupRace();
                    break;
                }
            }
        }
Beispiel #2
0
 public static void Main(string[] args)
 {
     try
     {
         Config.LoadConfig();
         if (Config.IsNeedUpdateDatabase)
         {
             using (var context = new AppDbContext())
             {
                 context.Database.Migrate();
             }
         }
         Module.Initialize();
         var bot       = new Bot();
         var pubSubBot = new PubSubBot();
         Minutes = Config.ShopShowMinutes;
         while (true)
         {
             if (Minutes >= Config.ShopShowMinutes && bot.IsOn)
             {
                 ShopAction.ChangeCars(Config.Channel, bot);
             }
             Minutes += 5;
             Thread.Sleep(TimeSpan.FromMinutes(5));
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         if (count < 5)
         {
             count++;
             Main(null);
         }
     }
 }