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.Models.DbModels;
|
||||||
using KfChatDotNetBot.Settings;
|
using KfChatDotNetBot.Settings;
|
||||||
using KfChatDotNetWsClient.Models.Events;
|
using KfChatDotNetWsClient.Models.Events;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace KfChatDotNetBot.Services;
|
namespace KfChatDotNetBot.Services;
|
||||||
@@ -61,7 +62,7 @@ internal class BotCommands
|
|||||||
if (!match.Success) continue;
|
if (!match.Success) continue;
|
||||||
_logger.Debug($"Message matches {regex}");
|
_logger.Debug($"Message matches {regex}");
|
||||||
using var db = new ApplicationDbContext();
|
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
|
// This should never happen as brand-new users are created upon join
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
if (user.Ignored) return;
|
if (user.Ignored) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user