mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Trying to avoid tracking issues
This commit is contained in:
@@ -7,6 +7,7 @@ using KfChatDotNetBot.Models;
|
||||
using KfChatDotNetBot.Models.DbModels;
|
||||
using KfChatDotNetBot.Settings;
|
||||
using KfChatDotNetWsClient.Models.Events;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NLog;
|
||||
|
||||
namespace KfChatDotNetBot.Services;
|
||||
@@ -61,7 +62,7 @@ internal class BotCommands
|
||||
if (!match.Success) continue;
|
||||
_logger.Debug($"Message matches {regex}");
|
||||
using var db = new ApplicationDbContext();
|
||||
var user = db.Users.FirstOrDefault(u => u.KfId == message.Author.Id);
|
||||
var user = db.Users.AsNoTracking().FirstOrDefault(u => u.KfId == message.Author.Id);
|
||||
// This should never happen as brand-new users are created upon join
|
||||
if (user == null) return;
|
||||
if (user.Ignored) return;
|
||||
|
||||
Reference in New Issue
Block a user