Skip to content

on_command_completion Lifecycle Event #99

Description

@PenguinBoi12

The current lifecycle events for commands are on_command (fires before execution) and on_command_error (fires on failure). There is no hook for successful completion, making it impossible to cleanly implement concerns like audit logging, metrics, or post-command cleanup without patching into after_invoke on every individual command.

Adding on_command_completion to LIFECYCLE_EVENTS fills that gap. It would fire after a command finishes without raising an exception, receiving the same Context object as on_command.

Proposed API

@bot.hook
async def on_command_completion(ctx):
    print(f"{ctx.command} completed successfully for {ctx.sender}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions