Revert "Merge pull request #12" (#56)

This reverts commit 42c0a8d8a5.
This commit is contained in:
Gnome!
2021-09-05 18:37:51 +01:00
committed by GitHub
parent 65640ddfc7
commit 53a6b2cb45
9 changed files with 84 additions and 74 deletions

View File

@@ -43,7 +43,6 @@ from .context import Context
from . import errors
from .help import HelpCommand, DefaultHelpCommand
from .cog import Cog
from discord.utils import raise_expected_coro
if TYPE_CHECKING:
import importlib.machinery
@@ -425,9 +424,11 @@ class BotBase(GroupMixin):
TypeError
The coroutine passed is not actually a coroutine.
"""
return raise_expected_coro(
coro, 'The pre-invoke hook must be a coroutine.'
)
if not asyncio.iscoroutinefunction(coro):
raise TypeError('The pre-invoke hook must be a coroutine.')
self._before_invoke = coro
return coro
def after_invoke(self, coro: CFT) -> CFT:
r"""A decorator that registers a coroutine as a post-invoke hook.
@@ -456,10 +457,11 @@ class BotBase(GroupMixin):
TypeError
The coroutine passed is not actually a coroutine.
"""
return raise_expected_coro(
coro, 'The post-invoke hook must be a coroutine.'
)
if not asyncio.iscoroutinefunction(coro):
raise TypeError('The post-invoke hook must be a coroutine.')
self._after_invoke = coro
return coro
# listener registration