Fix erroneous DMs for non-admin commands in admin cogs

This commit is contained in:
Zeva Rose 2022-04-29 19:16:45 -06:00
parent a68b9fd8f2
commit 7af0b765f8

View file

@ -21,6 +21,7 @@ from jarvis_core.db.models import (
from jarvis.utils import build_embed
MODLOG_LOOKUP = {"Ban": Ban, "Kick": Kick, "Mute": Mute, "Warning": Warning}
IGNORE_COMMANDS = {"Ban": ["bans"], "Kick": [], "Mute": ["unmute"], "Warning": ["warnings"]}
class CacheCog(Scale):
@ -67,7 +68,7 @@ class ModcaseCog(Scale):
"""
name = self.__name__.replace("Cog", "")
if name not in ["Lock", "Lockdown", "Purge", "Roleping"]:
if name in MODLOG_LOOKUP and ctx.command not in IGNORE_COMMANDS[name]:
user = kwargs.pop("user", None)
if not user and not ctx.target_id:
self.logger.warn(f"Admin action {name} missing user, exiting")