mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Make DatabaseHandler not error on non-existent chat
This commit is contained in:
parent
00dd51cea9
commit
13e3be89b3
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Perfusion;
|
||||
|
||||
namespace JetKarmaBot.Services.Handling
|
||||
@ -13,7 +14,7 @@ namespace JetKarmaBot.Services.Handling
|
||||
using (var db = Db.GetContext())
|
||||
{
|
||||
ctx.Features.Add(db); // KarmaContext
|
||||
ctx.Features.Add(Locale[(await db.Chats.FindAsync(ctx.EventArgs.Message.Chat.Id)).Locale]); // Locale
|
||||
ctx.Features.Add(Locale[(await db.Chats.FindAsync(ctx.EventArgs.Message.Chat.Id))?.Locale ?? "ru-ru"]); // Locale
|
||||
await next(ctx);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user