diff options
| author | Rapptz <[email protected]> | 2018-06-10 18:09:14 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-06-10 18:10:00 -0400 |
| commit | f25091efe1281aebe70189c61f9cac405b21a72f (patch) | |
| tree | d0d13dad1a89de9f45845a36ea475098b7a0b494 /discord/ext/commands/context.py | |
| parent | Add Message.jump_to_url (diff) | |
| download | discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.tar.xz discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.zip | |
Drop support for Python 3.4 and make minimum version 3.5.2.
Diffstat (limited to 'discord/ext/commands/context.py')
| -rw-r--r-- | discord/ext/commands/context.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index 303c1051..dfe1a9ed 100644 --- a/discord/ext/commands/context.py +++ b/discord/ext/commands/context.py @@ -86,8 +86,7 @@ class Context(discord.abc.Messageable): self.command_failed = attrs.pop('command_failed', False) self._state = self.message._state - @asyncio.coroutine - def invoke(self, *args, **kwargs): + async def invoke(self, *args, **kwargs): """|coro| Calls a command with the arguments given. @@ -125,11 +124,10 @@ class Context(discord.abc.Messageable): arguments.append(self) arguments.extend(args[1:]) - ret = yield from command.callback(*arguments, **kwargs) + ret = await command.callback(*arguments, **kwargs) return ret - @asyncio.coroutine - def reinvoke(self, *, call_hooks=False, restart=True): + async def reinvoke(self, *, call_hooks=False, restart=True): """|coro| Calls the command again. @@ -174,7 +172,7 @@ class Context(discord.abc.Messageable): to_call = cmd try: - yield from to_call.reinvoke(self, call_hooks=call_hooks) + await to_call.reinvoke(self, call_hooks=call_hooks) finally: self.command = cmd view.index = index @@ -188,8 +186,7 @@ class Context(discord.abc.Messageable): """Checks if the invocation context is valid to be invoked with.""" return self.prefix is not None and self.command is not None - @asyncio.coroutine - def _get_channel(self): + async def _get_channel(self): return self.channel @property |