aboutsummaryrefslogtreecommitdiffstats
path: root/bot/__init__.py
diff options
context:
space:
mode:
authorGravatar rohan <[email protected]>2021-05-10 01:58:31 +0530
committerGravatar rohan <[email protected]>2021-05-10 01:58:31 +0530
commit2eda11d5110103d65ee684f4626d7c1ae59b32c9 (patch)
treefbbbcf61ef0797722a1ea8136aaa412cd6283365 /bot/__init__.py
parentFix Bug:Paginated embed image gets carried to next page (diff)
parentMerge pull request #724 from ToxicKidz/fix/mosaic-command (diff)
Pull upstream and resolve conflicts.
Diffstat (limited to 'bot/__init__.py')
-rw-r--r--bot/__init__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index bdb18666..71b7c8a3 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -2,11 +2,15 @@ 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
+from bot.group import Group
# Configure the "TRACE" logging level (e.g. "log.trace(message)")
@@ -56,6 +60,7 @@ if root.handlers:
logging.getLogger("discord").setLevel(logging.ERROR)
logging.getLogger("websockets").setLevel(logging.ERROR)
logging.getLogger("PIL").setLevel(logging.ERROR)
+logging.getLogger("matplotlib").setLevel(logging.ERROR)
# Setup new logging configuration
logging.basicConfig(
@@ -70,3 +75,12 @@ 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 both the Command and Group subclasses 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)
+
+commands.group = partial(commands.group, cls=Group)
+commands.GroupMixin.group = partialmethod(commands.GroupMixin.group, cls=Group)