|
14 | 14 | from libs.tickets.structs import PartialConfig, ReservedTags, StatusChecklist
|
15 | 15 | from libs.tickets.utils import get_cached_thread, get_partial_ticket
|
16 | 16 | from libs.tickets.views import TicketConfirmView
|
17 |
| -from libs.utils import ( |
18 |
| - RoboContext, |
19 |
| - RodhajCommandTree, |
20 |
| - RodhajHelp, |
21 |
| - send_error_embed, |
22 |
| -) |
| 17 | +from libs.utils import RoboContext, RodhajCommandTree, RodhajHelp |
23 | 18 | from libs.utils.config import RodhajConfig
|
24 | 19 | from libs.utils.prefix import get_prefix
|
25 | 20 | from libs.utils.reloader import Reloader
|
26 | 21 |
|
27 | 22 | if TYPE_CHECKING:
|
28 | 23 | from cogs.tickets import Tickets
|
| 24 | + from libs.utils.context import RoboContext |
29 | 25 |
|
30 | 26 |
|
31 | 27 | class Rodhaj(commands.Bot):
|
@@ -89,9 +85,24 @@ async def get_context(
|
89 | 85 | return await super().get_context(origin, cls=cls)
|
90 | 86 |
|
91 | 87 | async def on_command_error(
|
92 |
| - self, ctx: commands.Context, error: commands.CommandError |
| 88 | + self, ctx: RoboContext, error: commands.CommandError |
93 | 89 | ) -> None:
|
94 |
| - await send_error_embed(ctx, error) |
| 90 | + if self._dev_mode: |
| 91 | + self.logger.exception("Ignoring exception:", exc_info=error) |
| 92 | + return |
| 93 | + |
| 94 | + if isinstance(error, commands.NoPrivateMessage): |
| 95 | + await ctx.author.send("This command cannot be used in private messages") |
| 96 | + elif isinstance(error, commands.MissingRequiredArgument): |
| 97 | + await ctx.send( |
| 98 | + f"You are missing the following argument(s): {error.param.name}" |
| 99 | + ) |
| 100 | + elif isinstance(error, commands.CommandInvokeError): |
| 101 | + original = error.original |
| 102 | + if not isinstance(original, discord.HTTPException): |
| 103 | + self.logger.exception("In %s:", ctx.command.qualified_name, exc_info=original) # type: ignore |
| 104 | + elif isinstance(error, commands.BadArgument): |
| 105 | + await ctx.send(str(error)) |
95 | 106 |
|
96 | 107 | ### Ticket processing and handling
|
97 | 108 |
|
|
0 commit comments