Fix deletion area of keys to prevent false positives

This commit is contained in:
Zeva Rose 2022-05-03 01:27:42 -06:00
parent 1c30e27ec9
commit e1efb7be55

View file

@ -659,6 +659,7 @@ class Jarvis(Client):
return
user_key = f"msg|{context.message.id}"
action_key = ""
if context.custom_id == "modcase|yes":
if user_id := await self.redis.get(user_key):
@ -698,12 +699,11 @@ class Jarvis(Client):
self.logger.warn("Unable to get action data ( %s )", action_key)
await context.send("Unable to get action data", ephemeral=True)
await self.bot.redis.delete(user_key)
await self.bot.redis.delete(action_key)
for row in context.message.components:
for component in row.components:
component.disabled = True
await context.message.edit(components=context.message.components)
msg = "Cancelled" if context.custom_id == "modcase|no" else "Moderation case opened"
await context.send(msg)
await self.bot.redis.delete(user_key)
await self.bot.redis.delete(action_key)