diff options
| author | Illia K <[email protected]> | 2016-11-28 19:21:33 +0000 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-28 12:13:46 -0800 |
| commit | 83515e1a5ccc850a8c352060a19394a53aed8454 (patch) | |
| tree | e5531327c82e37ae8b6874ebcba4b81746b4dd1e /examples/06_command_framework/src | |
| parent | Improve docs and add new message builder methods (diff) | |
| download | serenity-83515e1a5ccc850a8c352060a19394a53aed8454.tar.xz serenity-83515e1a5ccc850a8c352060a19394a53aed8454.zip | |
Add before/after framework command hooks
These hooks will each be run prior to or after the command, and will
finish execution before executing the command.
These can be configured in a Framework via:
```rs
client.with_framework(|f| f
.before(|_context, message, _command_name| {
println!("Got command '{}'", command_name);
})
.after(|_context, _message, command_name| {
println!("Finished command '{}'", command_name);
}));
```
This does introduce a backwards compatibility break, by requiring
commands' Context/Message to be borrowed
Upgrade path:
If not using the `command!` macro, modify command signatures from:
```rs
fn some_command(context: Context, message: Message, args: Vec<String>)
```
to
```rs
fn some_command(context: &Context, message: &Message, args: Vec<String>)
```
Diffstat (limited to 'examples/06_command_framework/src')
0 files changed, 0 insertions, 0 deletions