.lsar will now show if it cleans up some deleted roles, and show the proper count

This commit is contained in:
Master Kwoth 2017-05-16 22:50:30 +02:00
parent 78c3fbf55a
commit 515dfc1eb2
2 changed files with 4 additions and 3 deletions

View File

@ -108,7 +108,6 @@ namespace NadekoBot.Modules.Administration
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
{ {
var roleModels = uow.SelfAssignedRoles.GetFromGuild(Context.Guild.Id).ToList(); var roleModels = uow.SelfAssignedRoles.GetFromGuild(Context.Guild.Id).ToList();
roleCnt = roleModels.Count;
msg.AppendLine(); msg.AppendLine();
foreach (var roleModel in roleModels) foreach (var roleModel in roleModels)
@ -116,11 +115,13 @@ namespace NadekoBot.Modules.Administration
var role = Context.Guild.Roles.FirstOrDefault(r => r.Id == roleModel.RoleId); var role = Context.Guild.Roles.FirstOrDefault(r => r.Id == roleModel.RoleId);
if (role == null) if (role == null)
{ {
toRemove.Add(roleModel);
uow.SelfAssignedRoles.Remove(roleModel); uow.SelfAssignedRoles.Remove(roleModel);
} }
else else
{ {
msg.Append($"**{role.Name}**, "); msg.Append($"**{role.Name}**, ");
roleCnt++;
} }
} }
foreach (var role in toRemove) foreach (var role in toRemove)

View File

@ -82,9 +82,9 @@ namespace NadekoBot.Modules.Games
var prefix = NadekoBot.ModulePrefixes[typeof(Games).Name]; var prefix = NadekoBot.ModulePrefixes[typeof(Games).Name];
var toSend = dropAmount == 1 var toSend = dropAmount == 1
? GetLocalText(channel, "curgen_sn", NadekoBot.BotConfig.CurrencySign) ? GetLocalText(channel, "curgen_sn", NadekoBot.BotConfig.CurrencySign)
+ GetLocalText(channel, "pick_sn", prefix) + " " + GetLocalText(channel, "pick_sn", prefix)
: GetLocalText(channel, "curgen_pl", dropAmount, NadekoBot.BotConfig.CurrencySign) : GetLocalText(channel, "curgen_pl", dropAmount, NadekoBot.BotConfig.CurrencySign)
+ GetLocalText(channel, "pick_pl", prefix); + " " + GetLocalText(channel, "pick_pl", prefix);
var file = GetRandomCurrencyImage(); var file = GetRandomCurrencyImage();
using (var fileStream = file.Value.ToStream()) using (var fileStream = file.Value.ToStream())
{ {