mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04: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.Runtime.Caching;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
|
using KfChatDotNetBot.Extensions;
|
||||||
using KfChatDotNetBot.Models;
|
using KfChatDotNetBot.Models;
|
||||||
using KfChatDotNetBot.Models.DbModels;
|
using KfChatDotNetBot.Models.DbModels;
|
||||||
using KfChatDotNetBot.Settings;
|
using KfChatDotNetBot.Settings;
|
||||||
@@ -374,6 +375,13 @@ public class IgnoreCommand : ICommand
|
|||||||
return;
|
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;
|
targetUser.Ignored = true;
|
||||||
await db.SaveChangesAsync(ctx);
|
await db.SaveChangesAsync(ctx);
|
||||||
await botInstance.SendChatMessageAsync($"Now ignoring {targetUser.KfUsername}", true);
|
await botInstance.SendChatMessageAsync($"Now ignoring {targetUser.KfUsername}", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user