From 10cf0802af4ba491f0b714a81f16637fadfd5810 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 28 Jun 2022 22:35:37 +0100 Subject: Use monkey patches from botcore --- bot/__init__.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'bot/__init__.py') diff --git a/bot/__init__.py b/bot/__init__.py index 3136c863..c1ecb30f 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -8,15 +8,14 @@ except ModuleNotFoundError: import asyncio import logging import os -from functools import partial, partialmethod 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 sentry_logging = LoggingIntegration( level=logging.DEBUG, @@ -41,17 +40,4 @@ 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) - -commands.group = partial(commands.group, cls=monkey_patches.Group) -commands.GroupMixin.group = partialmethod(commands.GroupMixin.group, cls=monkey_patches.Group) +apply_monkey_patches() -- cgit v1.2.3