.ve now properly persists restarts

This commit is contained in:
Master Kwoth 2017-06-25 02:39:31 +02:00
parent e1baa3942a
commit 3f2eef5647

View File

@ -50,12 +50,12 @@ namespace NadekoBot.Services.Utility
public bool ToggleVerboseErrors(ulong guildId) public bool ToggleVerboseErrors(ulong guildId)
{ {
bool enabled;
using (var uow = _db.UnitOfWork) using (var uow = _db.UnitOfWork)
{ {
var gc = uow.GuildConfigs.For(guildId, set => set); var gc = uow.GuildConfigs.For(guildId, set => set);
gc.VerboseErrors = !gc.VerboseErrors; enabled = gc.VerboseErrors = !gc.VerboseErrors;
uow.Complete(); uow.Complete();
@ -65,15 +65,12 @@ namespace NadekoBot.Services.Utility
guildsEnabled.TryRemove(guildId); guildsEnabled.TryRemove(guildId);
} }
if (guildsEnabled.Add(guildId)) if (enabled)
{ guildsEnabled.Add(guildId);
return true;
}
else else
{
guildsEnabled.TryRemove(guildId); guildsEnabled.TryRemove(guildId);
return false;
} return enabled;
} }
} }