private async void SendHltbMessage(string username, string message, string channel) { username = SendAMessageTo(username, ref message); string result; ParticipantInfo participantInfo = HasAParicipantAlias(message); string[] times; if (participantInfo != null) { times = await hltbParser.ParseGame(participantInfo.Game); } else { times = await hltbParser.ParseGame(message); } if (times != null) { result = $"Main story: {times[0].Replace("½", ".5")}. Main+Extra: {times[1].Replace("½", ".5")}"; } else { result = "не удалось найти информацию об этой игре"; } client.SendMessage(channel, $"@{username} {result}"); }
private static async void UpdateParticipantInfo(string name) { while (true) { ParticipantInfo newParticipantInfo = hpgDocParser.GetParticipantInfo(ParticipantDictionary[name].Name); if (newParticipantInfo.Game == ParticipantDictionary[name].Game) { newParticipantInfo.HoursToComplete = ParticipantDictionary[name].HoursToComplete; newParticipantInfo.FinalGgp = ParticipantDictionary[name].FinalGgp; } else { string[] hltbTimes = await hltbParser.ParseGame(newParticipantInfo.Game); if (hltbTimes != null) { newParticipantInfo.HoursToComplete = hltbTimes[0]; } else { newParticipantInfo.HoursToComplete = "---"; } newParticipantInfo.FinalGgp = hpgDocParser.GetLastGameGgp(newParticipantInfo); } ParticipantDictionary[name] = newParticipantInfo; Thread.Sleep(Delay * 1000); } }