Fixed .logserver - should no longer throw an exception if you had no logsettings previously

This commit is contained in:
Kwoth
2021-09-17 17:19:11 +02:00
parent e70a91ae60
commit 4a50c30c56
2 changed files with 15 additions and 1 deletions

View File

@@ -120,6 +120,15 @@ namespace NadekoBot.Db
.Include(x => x.IgnoredChannels)
.Where(x => x.GuildId == guildId)
.FirstOrDefault();
if (logSetting is null)
{
ctx.LogSettings.Add(logSetting = new ()
{
GuildId = guildId
});
ctx.SaveChanges();
}
return logSetting;
}