Check rights for users before ignoring

This commit is contained in:
barelyprofessional
2026-02-18 00:40:26 -06:00
parent e4815a2290
commit e5f98fe24c

View File

@@ -1,6 +1,7 @@
using System.Runtime.Caching;
using System.Text.RegularExpressions;
using Humanizer;
using KfChatDotNetBot.Extensions;
using KfChatDotNetBot.Models;
using KfChatDotNetBot.Models.DbModels;
using KfChatDotNetBot.Settings;
@@ -374,6 +375,13 @@ public class IgnoreCommand : ICommand
return;
}
if (targetUser.UserRight > user.UserRight)
{
await botInstance.SendChatMessageAsync(
$"{user.FormatUsername()}, you can't ignore someone who is more powerful than you", true);
return;
}
targetUser.Ignored = true;
await db.SaveChangesAsync(ctx);
await botInstance.SendChatMessageAsync($"Now ignoring {targetUser.KfUsername}", true);