Clash of clans crashfix
This commit is contained in:
parent
02338876bf
commit
93480f9b4d
@ -25,13 +25,16 @@ namespace NadekoBot.Modules.ClashOfClans
|
|||||||
{
|
{
|
||||||
ClashWars = new ConcurrentDictionary<ulong, List<ClashWar>>(
|
ClashWars = new ConcurrentDictionary<ulong, List<ClashWar>>(
|
||||||
uow.ClashOfClans
|
uow.ClashOfClans
|
||||||
.GetAll()
|
.GetAllWars()
|
||||||
.Select(cw => {
|
.Select(cw => {
|
||||||
|
if (cw == null || cw.Bases == null)
|
||||||
|
return null;
|
||||||
cw.Channel = NadekoBot.Client.GetGuild(cw.GuildId)
|
cw.Channel = NadekoBot.Client.GetGuild(cw.GuildId)
|
||||||
?.GetTextChannel(cw.ChannelId);
|
?.GetTextChannel(cw.ChannelId);
|
||||||
cw.Bases.Capacity = cw.Size;
|
cw.Bases.Capacity = cw.Size;
|
||||||
return cw;
|
return cw;
|
||||||
})
|
})
|
||||||
|
.Where(cw => cw?.Channel != null)
|
||||||
.GroupBy(cw => cw.GuildId)
|
.GroupBy(cw => cw.GuildId)
|
||||||
.ToDictionary(g => g.Key, g => g.ToList()));
|
.ToDictionary(g => g.Key, g => g.ToList()));
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ namespace NadekoBot
|
|||||||
public static StatsService Stats { get; private set; }
|
public static StatsService Stats { get; private set; }
|
||||||
|
|
||||||
public static ConcurrentDictionary<string, string> ModulePrefixes { get; private set; }
|
public static ConcurrentDictionary<string, string> ModulePrefixes { get; private set; }
|
||||||
|
public static bool Ready { get; private set; }
|
||||||
|
|
||||||
public async Task RunAsync(string[] args)
|
public async Task RunAsync(string[] args)
|
||||||
{
|
{
|
||||||
@ -97,6 +98,7 @@ namespace NadekoBot
|
|||||||
#if !GLOBAL_NADEKO
|
#if !GLOBAL_NADEKO
|
||||||
await CommandService.Load(new Music(Localizer, CommandService, Client, Google)).ConfigureAwait(false);
|
await CommandService.Load(new Music(Localizer, CommandService, Client, Google)).ConfigureAwait(false);
|
||||||
#endif
|
#endif
|
||||||
|
Ready = true;
|
||||||
Console.WriteLine(await Stats.Print().ConfigureAwait(false));
|
Console.WriteLine(await Stats.Print().ConfigureAwait(false));
|
||||||
|
|
||||||
await Task.Delay(-1);
|
await Task.Delay(-1);
|
||||||
|
@ -72,7 +72,7 @@ namespace NadekoBot.Services
|
|||||||
if (usrMsg == null)
|
if (usrMsg == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (usrMsg.Author.IsBot) //no bots
|
if (usrMsg.Author.IsBot || !NadekoBot.Ready) //no bots
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var guild = (msg.Channel as ITextChannel)?.Guild;
|
var guild = (msg.Channel as ITextChannel)?.Guild;
|
||||||
|
@ -9,6 +9,6 @@ namespace NadekoBot.Services.Database.Repositories
|
|||||||
{
|
{
|
||||||
public interface IClashOfClansRepository : IRepository<ClashWar>
|
public interface IClashOfClansRepository : IRepository<ClashWar>
|
||||||
{
|
{
|
||||||
|
IEnumerable<ClashWar> GetAllWars();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,11 @@ namespace NadekoBot.Services.Database.Repositories.Impl
|
|||||||
public ClashOfClansRepository(DbContext context) : base(context)
|
public ClashOfClansRepository(DbContext context) : base(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<ClashWar> GetAllWars()
|
||||||
|
{
|
||||||
|
return _set.Include(cw => cw.Bases)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user