From 326725d03fef0d05b259b74bb1aced994b9a4146 Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:18:59 -0500 Subject: [PATCH] Added the ability to ignore the already exists check for adding images using a special keyword --- KfChatDotNetBot/Commands/ImageCommands.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/KfChatDotNetBot/Commands/ImageCommands.cs b/KfChatDotNetBot/Commands/ImageCommands.cs index 6204593..8e99371 100644 --- a/KfChatDotNetBot/Commands/ImageCommands.cs +++ b/KfChatDotNetBot/Commands/ImageCommands.cs @@ -13,7 +13,9 @@ public class AddImageCommand : ICommand { public List Patterns => [ new Regex(@"^admin image (?\w+) add (?.+)$"), - new Regex(@"^admin images (?\w+) add (?.+)$") + new Regex(@"^admin images (?\w+) add (?.+)$"), + new Regex(@"^admin image (?\w+) add_nigger (?.+)$"), + new Regex(@"^admin images (?\w+) add_nigger (?.+)$") ]; public string? HelpText => "Add an image to the image rotation specified"; public UserRight RequiredRight => UserRight.TrueAndHonest; @@ -27,6 +29,7 @@ public class AddImageCommand : ICommand if (imageKeys == null) throw new InvalidOperationException($"{BuiltIn.Keys.BotImageAcceptableKeys} was null"); var key = arguments["key"].Value; var url = arguments["url"].Value; + var niggerMode = message.Message.Contains("add_nigger"); if (!imageKeys.Contains(key)) { await botInstance.SendChatMessageAsync( @@ -34,7 +37,7 @@ public class AddImageCommand : ICommand return; } - if (await db.Images.AnyAsync(i => i.Key == key && i.Url == url, ctx)) + if (!niggerMode && await db.Images.AnyAsync(i => i.Key == key && i.Url == url, ctx)) { await botInstance.SendChatMessageAsync("This image already exists in the database with this key", true); return;