Possible fix for .iamn close #1742

This commit is contained in:
Master Kwoth 2017-10-23 19:55:36 +02:00
parent fb6d89368e
commit 3005ae3595
4 changed files with 7 additions and 5 deletions

View File

@ -269,7 +269,8 @@ namespace NadekoBot.Modules.Administration
{ {
autoDeleteSelfAssignedRoleMessages = uow.GuildConfigs.For(Context.Guild.Id, set => set).AutoDeleteSelfAssignedRoleMessages; autoDeleteSelfAssignedRoleMessages = uow.GuildConfigs.For(Context.Guild.Id, set => set).AutoDeleteSelfAssignedRoleMessages;
roles = uow.SelfAssignedRoles.GetFromGuild(Context.Guild.Id) roles = uow.SelfAssignedRoles.GetFromGuild(Context.Guild.Id)
.SelectMany(x => x); .SelectMany(x => x)
.ToArray();
} }
if (roles.FirstOrDefault(r => r.RoleId == role.Id) == null) if (roles.FirstOrDefault(r => r.RoleId == role.Id) == null)
{ {

View File

@ -7,6 +7,6 @@ namespace NadekoBot.Core.Services.Database.Repositories
public interface ISelfAssignedRolesRepository : IRepository<SelfAssignedRole> public interface ISelfAssignedRolesRepository : IRepository<SelfAssignedRole>
{ {
bool DeleteByGuildAndRoleId(ulong guildId, ulong roleId); bool DeleteByGuildAndRoleId(ulong guildId, ulong roleId);
IEnumerable<IGrouping<int, SelfAssignedRole>> GetFromGuild(ulong guildId); IGrouping<int, SelfAssignedRole>[] GetFromGuild(ulong guildId);
} }
} }

View File

@ -22,9 +22,10 @@ namespace NadekoBot.Core.Services.Database.Repositories.Impl
return true; return true;
} }
public IEnumerable<IGrouping<int, SelfAssignedRole>> GetFromGuild(ulong guildId) public IGrouping<int, SelfAssignedRole>[] GetFromGuild(ulong guildId)
=> _set.Where(s => s.GuildId == guildId) => _set.Where(s => s.GuildId == guildId)
.AsEnumerable() .AsEnumerable()
.GroupBy(x => x.Group); .GroupBy(x => x.Group)
.ToArray();
} }
} }

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly DateTime _started; private readonly DateTime _started;
public const string BotVersion = "2.0.4"; public const string BotVersion = "2.1.0";
public string Author => "Kwoth#2560"; public string Author => "Kwoth#2560";
public string Library => "Discord.Net"; public string Library => "Discord.Net";