private async Task PollAsync() { var newStats = statisticsProvider.GetTotalStatistics(); if (newStats.IsFail) { if (wasFail) { return; } wasFail = true; await Core.Guild.GetTextChannel(settings.ChannelId).SendMessageAsync($"Мужики, помогите. Не получилось :\n{newStats}") .ConfigureAwait(false); } else { wasFail = false; if (currentStatistics == null) { currentStatistics = newStats.Value.ToDictionary(k => k.Player); return; } var diffs = ShowDifferences(newStats.Value) .Where(s => s.Kills > 0) .Select(s => (statisticsProvider.GetCharacterStatistics(s.Link).Value, s.Kills)) // check IsFail .ToArray(); if (diffs.Length > 0) { try { var message = FormMessage(diffs); foreach (var batch in SplitMessage(message, 1600)) { await Core.Guild.GetTextChannel(settings.ChannelId).SendMessageAsync(batch) .ConfigureAwait(false); } } catch (Exception e) { await Core.Guild.GetTextChannel(settings.ChannelId).SendMessageAsync(e.Message) .ConfigureAwait(false); } } currentStatistics = newStats.Value.ToDictionary(k => k.Player); } }