diff --git a/cogs/automod/parsers/condition.py b/cogs/automod/parsers/condition.py index 51bb5d55..9465c7cf 100644 --- a/cogs/automod/parsers/condition.py +++ b/cogs/automod/parsers/condition.py @@ -20,6 +20,9 @@ def __repr__(self) -> str: return f"" async def check(self, **kw) -> bool: + if not self.data: + return True + for condition in self.data: func = getattr(self, condition["name"]) if not await maybe_coroutine(func, **kw): diff --git a/cogs/automod/parsers/triggers.py b/cogs/automod/parsers/triggers.py index 49ff1975..742ccc4d 100644 --- a/cogs/automod/parsers/triggers.py +++ b/cogs/automod/parsers/triggers.py @@ -42,6 +42,8 @@ def __repr__(self) -> str: return f"" async def check(self, **kw) -> bool: + if not self.data: + return False return self.operator(getattr(self, tgr["type"])(**{**kw, **tgr}) for tgr in self.data) def build_cooldowns(self) -> None: diff --git a/cogs/automod/views/__init__.py b/cogs/automod/views/__init__.py index 43184704..c63c3e51 100644 --- a/cogs/automod/views/__init__.py +++ b/cogs/automod/views/__init__.py @@ -24,7 +24,8 @@ def parse_dict(data: dict[str, Any]) -> str: - return "".join(f"`{k}: {v}`\n" if i == 0 else f"` {k}: {v}`\n" for i, (k, v) in enumerate(data.items())) + data = {k: v for k, v in data.items() if v} + return f"`{data}`" class Automod(ParrotView):