aboutsummaryrefslogtreecommitdiffstats
path: root/bot/cogs/moderation.py
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-09-25 17:20:17 -0700
committerGravatar MarkKoz <[email protected]>2019-09-25 17:20:17 -0700
commit485b49b70b3bfe6d6abf2227336cd9f0aa7a4563 (patch)
treef2b7e4f1c47257fed6145b1e1388d1a39a874904 /bot/cogs/moderation.py
parentNote Type Correction (diff)
Fix AttributeError with cog special methods
Discord.py's internals use the __func__ attribute of special methods (cog_command_error, cog_check, cog_before_invoke, cog_after_invoke). Therefore the methods must be bound methods rather than static so that the attribute exists.
Diffstat (limited to '')
-rw-r--r--bot/cogs/moderation.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py
index f2ff7e6b2..2ad5b96f4 100644
--- a/bot/cogs/moderation.py
+++ b/bot/cogs/moderation.py
@@ -1282,8 +1282,8 @@ class Moderation(Scheduler, Cog):
# endregion
- @staticmethod
- async def cog_command_error(ctx: Context, error: Exception) -> None:
+ # This cannot be static (must have a __func__ attribute).
+ async def cog_command_error(self, ctx: Context, error: Exception) -> None:
"""Send a notification to the invoking context on a Union failure."""
if isinstance(error, BadUnionArgument):
if User in error.converters: