| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>)
```
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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);
```
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
| | |
|
| |
|