Fixed crash
This commit is contained in:
parent
8b3a438e34
commit
cf0f0be84f
@ -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));
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user