Code-Society-Lab / Code-Society-Lab/matrixpy
on_command_completion Lifecycle Event
- Dominant language
- Python
- Stars
- 14
- Forks
- 7
- Avg merge
- 8d 19h
- Merged PRs (30d)
- 5
Description
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**
```python
@bot.hook
async def on_command_completion(ctx):
print(f"{ctx.command} completed successfully for {ctx.sender}")
```
Contributor guide
Assessment
This issue has not been assessed yet.