Total Complexity | 1 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from pincer import Client |
||
2 | from pincer.objects import MessageContext, Embed |
||
3 | |||
4 | |||
5 | class ErrorHandler: |
||
6 | @Client.event |
||
7 | async def on_command_error(self, ctx: MessageContext, error: Exception): |
||
8 | return Embed( |
||
9 | "Oops...", |
||
10 | "An error occurred while trying to execute the " |
||
11 | f"`{ctx.command.app.name}` command! Please retry later!", |
||
12 | color=0xff0000 |
||
13 | ).add_field( |
||
14 | "Exception:", |
||
15 | f"```\n{type(error).__name__}:\n{error}\n```" |
||
16 | ) |
||
17 | |||
18 | |||
19 | setup = ErrorHandler |
||
20 |