aboutsummaryrefslogtreecommitdiffstats
path: root/bot/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/__init__.py')
-rw-r--r--bot/__init__.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index 3136c863..33fd4e1c 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -8,15 +8,18 @@ except ModuleNotFoundError:
import asyncio
import logging
import os
-from functools import partial, partialmethod
+from typing import TYPE_CHECKING
import arrow
import sentry_sdk
-from discord.ext import commands
+from botcore.utils import apply_monkey_patches
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.integrations.redis import RedisIntegration
-from bot import log, monkey_patches
+from bot import log
+
+if TYPE_CHECKING:
+ from bot.bot import Bot
sentry_logging = LoggingIntegration(
level=logging.DEBUG,
@@ -41,17 +44,6 @@ start_time = arrow.utcnow()
if os.name == "nt":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
-monkey_patches.patch_typing()
-
-# This patches any convertors that use PartialMessage, but not the PartialMessageConverter itself
-# as library objects are made by this mapping.
-# https://github.com/Rapptz/discord.py/blob/1a4e73d59932cdbe7bf2c281f25e32529fc7ae1f/discord/ext/commands/converter.py#L984-L1004
-commands.converter.PartialMessageConverter = monkey_patches.FixedPartialMessageConverter
-
-# 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=monkey_patches.Command)
-commands.GroupMixin.command = partialmethod(commands.GroupMixin.command, cls=monkey_patches.Command)
+apply_monkey_patches()
-commands.group = partial(commands.group, cls=monkey_patches.Group)
-commands.GroupMixin.group = partialmethod(commands.GroupMixin.group, cls=monkey_patches.Group)
+instance: "Bot" = None # Global Bot instance.