async def before_any_command(ctx: commands.Context): """Runs before any command""" ctx.timer = time() try: await ctx.typing() except Forbidden: pass
async def on_command_error(self, ctx: commands.Context, error): """only for CommandNotFound""" error = getattr(error, "original", error) if isinstance(error, commands.CommandNotFound ) and ctx.message.content.startswith(f"{ctx.prefix}!"): ctx.timer = time() ctx.iscallback = True ctx.command = self.bot.get_command("!") await ctx.command.callback(self, ctx)