Ejemplo n.º 1
0
 private void Timer_elapse(object sender, ElapsedEventArgs e)
 {
     Console.WriteLine(DateTime.Now + " : " + "Checking for XP changes");
     foreach (UserXp user in UserXPList)
     {
         string TotalXP = GetHighscore.GetTotalXP(user.OsrsName);
         if (user.OsrsXP != TotalXP)
         {
             //assumes they have logged out because the highscores have updated
             SendMessage(user);
             Console.WriteLine(DateTime.Now + " : " + user.OsrsName + "s xp has changed by" + (int.Parse(TotalXP) - int.Parse(user.OsrsXP)));
             user.OsrsXP = TotalXP;
         }
     }
 }
Ejemplo n.º 2
0
 public Program()
 {
     _client        = new DiscordSocketClient();
     _client.Ready += ReadyAsync;
     foreach (string name in UserList.Keys)
     {
         string TotalXP = GetHighscore.GetTotalXP(name);
         UserList.TryGetValue(name, out ulong discordID);
         UserXPList.AddLast(new UserXp(discordID.ToString(), name, TotalXP));
         Console.WriteLine(DateTime.Now + " : " + "Added user " + discordID.ToString() + " with Osrs Name " + name + " with total XP " + TotalXP);
     }
     timer           = new Timer(60000);
     timer.Elapsed  += Timer_elapse;
     timer.AutoReset = true;
     timer.Start();
 }