From 641d935f730370b8548eada9984d6932fa76a1a9 Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Thu, 24 Apr 2025 13:15:05 -0500 Subject: [PATCH] Added special logic for the inverted cube --- KfChatDotNetBot/Commands/ImageCommands.cs | 8 ++++++-- KfChatDotNetBot/Settings/BuiltIn.cs | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/KfChatDotNetBot/Commands/ImageCommands.cs b/KfChatDotNetBot/Commands/ImageCommands.cs index 5d33126..32b09c6 100644 --- a/KfChatDotNetBot/Commands/ImageCommands.cs +++ b/KfChatDotNetBot/Commands/ImageCommands.cs @@ -144,7 +144,8 @@ public class GetRandomImage : ICommand var images = db.Images.Where(i => i.Key == key); if (!await images.AnyAsync(ctx)) return; var settings = await Helpers.GetMultipleValues([ - BuiltIn.Keys.BotImageRandomSliceDivideBy, BuiltIn.Keys.BotImagePigCubeSelfDestruct + BuiltIn.Keys.BotImageRandomSliceDivideBy, BuiltIn.Keys.BotImagePigCubeSelfDestruct, + BuiltIn.Keys.BotImageInvertedCubeUrl ]); var divideBy = settings[BuiltIn.Keys.BotImageRandomSliceDivideBy].ToType(); var limit = 1; @@ -179,7 +180,10 @@ public class GetRandomImage : ICommand logger.Error($"Pig cube chat message ID was null even though status was {msg.Status}"); return; } - var timeToDeletionMsec = new Random().Next(5 * 1000, 60 * 1000); + + var timeToDeletionMsec = image.Url == settings[BuiltIn.Keys.BotImageInvertedCubeUrl].Value + ? 5000 + : new Random().Next(5 * 1000, 60 * 1000); await Task.Delay(timeToDeletionMsec, ctx); await botInstance.KfClient.DeleteMessageAsync(msg.ChatMessageId.Value); } diff --git a/KfChatDotNetBot/Settings/BuiltIn.cs b/KfChatDotNetBot/Settings/BuiltIn.cs index 11b8e4f..3df2c8a 100644 --- a/KfChatDotNetBot/Settings/BuiltIn.cs +++ b/KfChatDotNetBot/Settings/BuiltIn.cs @@ -783,6 +783,16 @@ public static class BuiltIn IsSecret = false, CacheDuration = TimeSpan.FromHours(1), ValueType = SettingValueType.Boolean + }, + new BuiltInSettingsModel + { + Key = Keys.BotImageInvertedCubeUrl, + Regex = ".+", + Description = "URL of the inverted pig cube for the special deletion logic", + Default = "https://kiwifarms.st/attachments/7226614-185d31e0b73350f2765b8051121a05d2-webp.7271720/", + IsSecret = false, + CacheDuration = TimeSpan.FromHours(1), + ValueType = SettingValueType.Text } ]; @@ -855,5 +865,6 @@ public static class BuiltIn public static string BotAlmanacInitialState = "Bot.Almanac.InitialState"; public static string JuiceAllowedWhileStreaming = "Juice.AllowedWhileStreaming"; public static string BotImagePigCubeSelfDestruct = "Bot.Image.PigCubeSelfDestruct"; + public static string BotImageInvertedCubeUrl = "Bot.Image.InvertedCubeUrl"; } } \ No newline at end of file