aboutsummaryrefslogtreecommitdiff
path: root/examples/06_command_framework/src
diff options
context:
space:
mode:
authorIllia K <[email protected]>2016-11-28 19:21:33 +0000
committerAustin Hellyer <[email protected]>2016-11-28 12:13:46 -0800
commit83515e1a5ccc850a8c352060a19394a53aed8454 (patch)
treee5531327c82e37ae8b6874ebcba4b81746b4dd1e /examples/06_command_framework/src
parentImprove docs and add new message builder methods (diff)
downloadserenity-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