Clash of clans crashfix

This commit is contained in:
Kwoth
2016-10-13 00:32:11 +02:00
parent 02338876bf
commit 93480f9b4d
5 changed files with 14 additions and 3 deletions

View File

@@ -25,13 +25,16 @@ namespace NadekoBot.Modules.ClashOfClans
{
ClashWars = new ConcurrentDictionary<ulong, List<ClashWar>>(
uow.ClashOfClans
.GetAll()
.GetAllWars()
.Select(cw => {
if (cw == null || cw.Bases == null)
return null;
cw.Channel = NadekoBot.Client.GetGuild(cw.GuildId)
?.GetTextChannel(cw.ChannelId);
cw.Bases.Capacity = cw.Size;
return cw;
})
.Where(cw => cw?.Channel != null)
.GroupBy(cw => cw.GuildId)
.ToDictionary(g => g.Key, g => g.ToList()));
}