Merge pull request #12

* Clean up python

* Clean up bot python

* revert lists

* revert commands.bot completely

* extract raise_expected_coro further

* add new lines

* removed erroneous import

* remove hashed line
This commit was merged in pull request #12.
This commit is contained in:
chillymosh authored and GitHub committed 2021-09-02 12:32:46 -07:00
1 parent 092fbca08f
commit 42c0a8d8a5
9 files changed
+74 -84

No files matched your search

+7 -9
View File
@@ -43,6 +43,7 @@ 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
@@ -424,11 +425,9 @@ class BotBase(GroupMixin):
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
raise TypeError('The pre-invoke hook must be a coroutine.')
self._before_invoke = coro
return coro
return raise_expected_coro(
coro, 'The pre-invoke hook must be a coroutine.'
)
def after_invoke(self, coro: CFT) -> CFT:
r"""A decorator that registers a coroutine as a post-invoke hook.
@@ -457,11 +456,10 @@ class BotBase(GroupMixin):
TypeError
The coroutine passed is not actually a coroutine.
"""
if not asyncio.iscoroutinefunction(coro):
raise TypeError('The post-invoke hook must be a coroutine.')
return raise_expected_coro(
coro, 'The post-invoke hook must be a coroutine.'
)
self._after_invoke = coro
return coro
# listener registration