diff options
author | 2022-06-28 22:35:37 +0100 | |
---|---|---|
committer | 2022-09-21 23:02:55 +0100 | |
commit | 10cf0802af4ba491f0b714a81f16637fadfd5810 (patch) | |
tree | ac12e5b03947e6c96250cce94733fba80756ada7 /bot/__init__.py | |
parent | Don't override default flake8 ignore list (diff) |
Use monkey patches from botcore
Diffstat (limited to 'bot/__init__.py')
-rw-r--r-- | bot/__init__.py | 20 |
1 files changed, 3 insertions, 17 deletions
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() |