aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-14 12:49:42 -0500
committerRapptz <[email protected]>2016-01-14 12:49:42 -0500
commitbc7606a42c7394d7705320625cf09c842c60b923 (patch)
treefc57bdb186b4aaccee2c28726f18fdd28d0c24c3
parentDocumentation fixes for Permissions related code. (diff)
downloaddiscord.py-bc7606a42c7394d7705320625cf09c842c60b923.tar.xz
discord.py-bc7606a42c7394d7705320625cf09c842c60b923.zip
[commands] Add on_command and on_command_completion events.
-rw-r--r--discord/ext/commands/bot.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 4bcf6a43..8605f83f 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -514,7 +514,8 @@ class Bot(GroupMixin, discord.Client):
--------
This function is necessary for :meth:`say`, :meth:`whisper`,
:meth:`type`, :meth:`reply`, and :meth:`upload` to work due to the
- way they are written.
+ way they are written. It is also required for the :func:`on_command`
+ and :func:`on_command_completion` events.
Parameters
-----------
@@ -553,8 +554,10 @@ class Bot(GroupMixin, discord.Client):
if invoker in self.commands:
command = self.commands[invoker]
+ self.dispatch('command', command, ctx)
ctx.command = command
yield from command.invoke(ctx)
+ self.dispatch('command_completion', command, ctx)
else:
exc = CommandNotFound('Command "{}" is not found'.format(invoker))
self.dispatch('command_error', exc, ctx)