mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
Check rights for users before ignoring
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user