aboutsummaryrefslogtreecommitdiff
path: root/src/framework/standard/create_group.rs
diff options
context:
space:
mode:
authorMishio595 <[email protected]>2018-07-12 11:35:39 -0600
committerMishio595 <[email protected]>2018-07-12 11:35:39 -0600
commit026a37ffe12096a1da263b028df48a8d2909baa3 (patch)
tree1d1bf8f9c505408f13b7fd6f877bcf3fd15fa43c /src/framework/standard/create_group.rs
parentAdd 3rd param to MessageUpdateEvent Option that contains the old message if f... (diff)
downloadserenity-026a37ffe12096a1da263b028df48a8d2909baa3.tar.xz
serenity-026a37ffe12096a1da263b028df48a8d2909baa3.zip
Add checks for groups
Diffstat (limited to 'src/framework/standard/create_group.rs')
-rw-r--r--src/framework/standard/create_group.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/framework/standard/create_group.rs b/src/framework/standard/create_group.rs
index 18f6402..90219d6 100644
--- a/src/framework/standard/create_group.rs
+++ b/src/framework/standard/create_group.rs
@@ -1,4 +1,5 @@
pub use super::command::{
+ Check,
Command,
CommandGroup,
CommandOptions,
@@ -161,4 +162,18 @@ impl CreateGroup {
self
}
+
+ /// Adds a "check" to a group, which checks whether or not the groups's
+ /// commands should be called.
+ ///
+ /// **Note**: These checks are bypassed for commands sent by the application owner.
+ pub fn check<F>(mut self, check: F) -> Self
+ where F: Fn(&mut Context, &Message, &mut Args, &CommandOptions) -> bool
+ + Send
+ + Sync
+ + 'static {
+ self.0.checks.push(Check::new(check));
+
+ self
+ }
}