Merge remote-tracking branch 'refs/remotes/Kwoth/1.0' into 1.0-fearnlj01

This commit is contained in:
Jordan Fearnley 2016-10-25 11:43:31 +01:00
commit a92bdca62a
2 changed files with 15 additions and 9 deletions

View File

@ -47,16 +47,22 @@ namespace NadekoBot.Modules.Administration
}
t = new Timer(async (state) =>
{
try
{
var keys = UserPresenceUpdates.Keys.ToList();
await Task.WhenAll(keys.Select(key =>
await Task.WhenAll(keys.Select(async key =>
{
List<string> messages;
if (UserPresenceUpdates.TryRemove(key, out messages))
try { return key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { } //502/403
return Task.CompletedTask;
try { await key.SendMessageAsync(string.Join(Environment.NewLine, messages)); } catch { }
}));
}
catch (Exception ex)
{
_log.Warn(ex);
}
}, null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10));

View File

@ -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)