Skip to content

Commit 6ce5512

Browse files
committed
Added docs
1 parent 84fb29d commit 6ce5512

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

discord_slash/client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,31 @@ async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
424424
await self.on_slash_command_error(ctx, ex)
425425

426426
async def on_slash_command_error(self, ctx, ex):
427+
"""
428+
Handles Exception occurred from invoking command.
429+
430+
Example of adding event:
431+
432+
.. code-block:: python
433+
434+
@client.event
435+
async def on_slash_command_error(ctx, ex):
436+
...
437+
438+
Example of adding listener:
439+
440+
.. code-block:: python
441+
442+
@bot.listen()
443+
async def on_slash_command_error(ctx, ex):
444+
...
445+
446+
:param ctx: Context of the command.
447+
:type ctx: :class:`.model.SlashContext`
448+
:param ex: Exception from the command invoke.
449+
:type ex: Exception
450+
:return:
451+
"""
427452
if self.has_listener:
428453
if self._discord.extra_events.get('on_slash_command_error'):
429454
self._discord.dispatch("slash_command_error", ctx, ex)

0 commit comments

Comments
 (0)