Added special logic for the inverted cube

This commit is contained in:
barelyprofessional
2025-04-24 13:15:05 -05:00
parent c48c912e19
commit 641d935f73
2 changed files with 17 additions and 2 deletions

View File

@@ -144,7 +144,8 @@ public class GetRandomImage : ICommand
var images = db.Images.Where(i => i.Key == key); var images = db.Images.Where(i => i.Key == key);
if (!await images.AnyAsync(ctx)) return; if (!await images.AnyAsync(ctx)) return;
var settings = await Helpers.GetMultipleValues([ 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<int>(); var divideBy = settings[BuiltIn.Keys.BotImageRandomSliceDivideBy].ToType<int>();
var limit = 1; 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}"); logger.Error($"Pig cube chat message ID was null even though status was {msg.Status}");
return; 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 Task.Delay(timeToDeletionMsec, ctx);
await botInstance.KfClient.DeleteMessageAsync(msg.ChatMessageId.Value); await botInstance.KfClient.DeleteMessageAsync(msg.ChatMessageId.Value);
} }

View File

@@ -783,6 +783,16 @@ public static class BuiltIn
IsSecret = false, IsSecret = false,
CacheDuration = TimeSpan.FromHours(1), CacheDuration = TimeSpan.FromHours(1),
ValueType = SettingValueType.Boolean 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 BotAlmanacInitialState = "Bot.Almanac.InitialState";
public static string JuiceAllowedWhileStreaming = "Juice.AllowedWhileStreaming"; public static string JuiceAllowedWhileStreaming = "Juice.AllowedWhileStreaming";
public static string BotImagePigCubeSelfDestruct = "Bot.Image.PigCubeSelfDestruct"; public static string BotImagePigCubeSelfDestruct = "Bot.Image.PigCubeSelfDestruct";
public static string BotImageInvertedCubeUrl = "Bot.Image.InvertedCubeUrl";
} }
} }