Example #1
0
 internal void RefreshEvents(TwitchBot Bot)
 {
     bot = Bot;
     bot.client.OnChatCommandReceived    += ChatCommandHandler;
     bot.client.OnWhisperCommandReceived += WhisperCommandHandler;
 }
Example #2
0
 internal void RefreshEvents(TwitchBot Bot)
 {
     bot = Bot;
 }
Example #3
0
 public SubscriberCache(TwitchBot bot)
 {
     subs     = new Dictionary <string, Subscription>();
     this.bot = bot;
     LoadAllSubs();
 }
Example #4
0
        public CoinSystem(TwitchBot Bot, string userStatsPath, string backupDirectoryPath)
        {
            userStats    = new Dictionary <string, UserStats>();
            userStatsTxt = new TxtFile(userStatsPath);
            LoadStats();
            this.backupDirectoryPath = backupDirectoryPath;
            bot          = Bot;
            cache        = new SubscriberCache(bot);
            passiveCoins = new Timer(async(sender) =>
            {
                if (bot.online == false)
                {
                    return;
                }
                var list = await bot.GetChatList();
                if (list != null && list.Count > 0)
                {
                    foreach (var u in list)
                    {
                        int subTier = await cache.GetOrCreate(u.Username);
                        switch (subTier)
                        {
                        case 0:
                            AddCoins(u.Username, 1);
                            break;

                        case 1:
                            AddCoins(u.Username, 2);
                            break;

                        case 2:
                            AddCoins(u.Username, 3);
                            break;

                        case 3:
                            AddCoins(u.Username, 6);
                            break;
                        }
                    }
                    if (saveCounter >= 5)
                    {
                        SaveStats();
                        saveCounter = 0;
                    }
                    saveCounter++;
                }
            }, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5));

            /*chatTime = new Timer(async (sender) =>
             * {
             *  if (bot.online == false) return;
             *  var list = await bot.GetChatList();
             *  if (list != null)
             *  {
             *      foreach (var u in list)
             *      {
             *          AddTime(u.Username, 1);
             *      }
             *  }
             * },null,TimeSpan.FromMinutes(1),TimeSpan.FromMinutes(1));
             */
        }