aboutsummaryrefslogtreecommitdiffstats
path: root/bot/__init__.py
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-02-18 19:43:26 +0000
committerGravatar Chris <[email protected]>2021-02-18 19:43:26 +0000
commit032d4ae8300ed4570e0b471dd49f628f446cb1fa (patch)
tree2df2a45552018923159cf20509c7f4ceddc40d33 /bot/__init__.py
parentLog what func is being ran in the executor. (diff)
Add root alias support for commands
Diffstat (limited to 'bot/__init__.py')
-rw-r--r--bot/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index bdb18666..c8550537 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -2,10 +2,13 @@ import asyncio
import logging
import logging.handlers
import os
+from functools import partial, partialmethod
from pathlib import Path
import arrow
+from discord.ext import commands
+from bot.command import Command
from bot.constants import Client
@@ -70,3 +73,9 @@ logging.getLogger().info('Logging initialization complete')
# On Windows, the selector event loop is required for aiodns.
if os.name == "nt":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
+
+
+# Monkey-patch discord.py decorators to use the Command subclass which supports root aliases.
+# Must be patched before any cogs are added.
+commands.command = partial(commands.command, cls=Command)
+commands.GroupMixin.command = partialmethod(commands.GroupMixin.command, cls=Command)