From cf0f0be84f1ae6dd8c7c378a3830da16729db18b Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 24 Oct 2016 23:36:03 +0200 Subject: [PATCH 1/2] Fixed crash --- .../Administration/Commands/LogCommand.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs index e291522d..1ee43243 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LogCommand.cs @@ -48,15 +48,21 @@ namespace NadekoBot.Modules.Administration t = new Timer(async (state) => { - var keys = UserPresenceUpdates.Keys.ToList(); - - await Task.WhenAll(keys.Select(key => + try { - List messages; - if (UserPresenceUpdates.TryRemove(key, out messages)) - try { return key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { } //502/403 - return Task.CompletedTask; - })); + var keys = UserPresenceUpdates.Keys.ToList(); + + await Task.WhenAll(keys.Select(async key => + { + List messages; + if (UserPresenceUpdates.TryRemove(key, out messages)) + try { await key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { } + })); + } + catch (Exception ex) + { + _log.Warn(ex); + } }, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)); From f5193272f133b8ab07bc5752ebc5156e1a05b9a6 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 25 Oct 2016 00:04:06 +0200 Subject: [PATCH 2/2] Fixed poll ordering of results --- src/NadekoBot/Modules/Games/Commands/PollCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NadekoBot/Modules/Games/Commands/PollCommands.cs b/src/NadekoBot/Modules/Games/Commands/PollCommands.cs index 48cfde10..b0a3ca6d 100644 --- a/src/NadekoBot/Modules/Games/Commands/PollCommands.cs +++ b/src/NadekoBot/Modules/Games/Commands/PollCommands.cs @@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Games { var results = participants.GroupBy(kvp => kvp.Value) .ToDictionary(x => x.Key, x => x.Sum(kvp => 1)) - .OrderBy(kvp => kvp.Value); + .OrderByDescending(kvp => kvp.Value); var totalVotesCast = results.Sum(kvp => kvp.Value); if (totalVotesCast == 0)