aboutsummaryrefslogtreecommitdiff
path: root/examples/06_command_framework.rs
Commit message (Collapse)AuthorAgeFilesLines
* Clean up the codebaseAustin Hellyer2016-11-291-86/+0
|
* Optimize for cached, non-method compilesAustin Hellyer2016-11-281-0/+9
|
* Add before/after framework command hooksIllia K2016-11-281-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>) ```
* Add no-named-argument command macro matchAustin Hellyer2016-11-261-2/+2
|
* Add framework command named argumentsAustin Hellyer2016-11-211-0/+10
|
* Allow Id/u64 equality comparisonsAustin Hellyer2016-11-171-1/+1
| | | | | | | | | | | | | | This will allow comparing, for example, a `ChannelId` with a `u64` directly, bypassing the need to do something like: ```rust let channel_id = ChannelId(7); assert!(channel_id.0 == 7); // can now be replaced with: assert!(channel_id == 7); ```
* Framework: fix command arg positioningAustin Hellyer2016-11-081-1/+1
| | | | | | | | | | The command system assumed that prefixes were only one character long, so count the total length of the prefix. In addition, the `allow_whitespace` configuration added some difficulty in deciding where to count as the initial position to start splitting for arguments. Instead of fixing that, rewrite the framework to make these types of changes easier in the future.
* Add arguments to framework commandsAustin Hellyer2016-11-071-6/+6
|
* Add an 'allow_whitespace' framework configAustin Hellyer2016-11-061-0/+1
| | | | | | | | | | | | | | The option allows whitespace to be optional between a mention and a command. Setting it to true will allow the following scenario to occur, while false will not: ``` <@BOT_ID>about // bot process and executes the "about" command if it exists ```
* Fix typo in example 06Austin Hellyer2016-11-061-1/+1
|
* Initial commitAustin Hellyer2016-10-181-0/+62