Do not store rate limits for the GetRandomImage command unless a real key is specified

This commit is contained in:
barelyprofessional
2025-09-08 19:37:18 -05:00
parent b3c3734e22
commit d7e6290d46

View File

@@ -151,7 +151,11 @@ public class GetRandomImage : ICommand
await using var db = new ApplicationDbContext(); await using var db = new ApplicationDbContext();
var key = arguments["key"].Value.ToLower(); var key = arguments["key"].Value.ToLower();
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))
{
RateLimitService.RemoveMostRecentEntry(user, this);
return;
}
var settings = await SettingsProvider.GetMultipleValuesAsync([ var settings = await SettingsProvider.GetMultipleValuesAsync([
BuiltIn.Keys.BotImageRandomSliceDivideBy, BuiltIn.Keys.BotImagePigCubeSelfDestruct, BuiltIn.Keys.BotImageRandomSliceDivideBy, BuiltIn.Keys.BotImagePigCubeSelfDestruct,
BuiltIn.Keys.BotImageInvertedCubeUrl, BuiltIn.Keys.BotImagePigCubeSelfDestructMin, BuiltIn.Keys.BotImageInvertedCubeUrl, BuiltIn.Keys.BotImagePigCubeSelfDestructMin,