mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Added special logic for the inverted cube
This commit is contained in:
@@ -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<int>();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user