diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-13 22:01:02 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-13 22:01:02 -0700 |
| commit | 28456813f6f05e9bdaf08e8cad641df1e3dfaff7 (patch) | |
| tree | 09eb479537ee4284b57a06bc8d5962bab450f130 /src/framework/configuration.rs | |
| parent | Remove Context::{channel_id, queue} (diff) | |
| download | serenity-28456813f6f05e9bdaf08e8cad641df1e3dfaff7.tar.xz serenity-28456813f6f05e9bdaf08e8cad641df1e3dfaff7.zip | |
Make framework dynamic_prefix accept an &Message
Diffstat (limited to 'src/framework/configuration.rs')
| -rw-r--r-- | src/framework/configuration.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/framework/configuration.rs b/src/framework/configuration.rs index 0a1c351..fa76a21 100644 --- a/src/framework/configuration.rs +++ b/src/framework/configuration.rs @@ -3,7 +3,7 @@ use std::default::Default; use super::command::PrefixCheck; use ::client::Context; use ::http; -use ::model::{GuildId, UserId}; +use ::model::{GuildId, Message, UserId}; /// The configuration to use for a [`Framework`] associated with a [`Client`] /// instance. @@ -185,8 +185,8 @@ impl Configuration { /// # let mut client = Client::new("token"); /// client.with_framework(|f| f /// .command("ping", |c| c.exec_str("Pong!")) - /// .configure(|c| c.dynamic_prefix(|ctx| { - /// Some(if ctx.channel_id.unwrap().0 % 5 == 0 { + /// .configure(|c| c.dynamic_prefix(|_, msg| { + /// Some(if msg.channel_id.0 % 5 == 0 { /// "!" /// } else { /// "~" @@ -194,7 +194,7 @@ impl Configuration { /// }))); /// ``` pub fn dynamic_prefix<F>(mut self, dynamic_prefix: F) -> Self - where F: Fn(&mut Context) -> Option<String> + Send + Sync + 'static { + where F: Fn(&mut Context, &Message) -> Option<String> + Send + Sync + 'static { self.dynamic_prefix = Some(Box::new(dynamic_prefix)); self |