aboutsummaryrefslogtreecommitdiff
path: root/src/framework/standard/configuration.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-07-14 11:02:43 +0200
committeracdenisSK <[email protected]>2018-07-14 11:04:39 +0200
commit10bbffe9332edf8b8835d98cfffb8ec411162145 (patch)
tree6339c47029989f408f9dd1a92629d5e132065875 /src/framework/standard/configuration.rs
parentAdd docs for `Args::new` (diff)
downloadserenity-10bbffe9332edf8b8835d98cfffb8ec411162145.tar.xz
serenity-10bbffe9332edf8b8835d98cfffb8ec411162145.zip
Allow for nil prefixes in DMs
Fixes #339
Diffstat (limited to 'src/framework/standard/configuration.rs')
-rw-r--r--src/framework/standard/configuration.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/framework/standard/configuration.rs b/src/framework/standard/configuration.rs
index 01d3b01..7b2caf5 100644
--- a/src/framework/standard/configuration.rs
+++ b/src/framework/standard/configuration.rs
@@ -53,6 +53,7 @@ pub struct Configuration {
#[doc(hidden)] pub on_mention: Option<Vec<String>>,
#[doc(hidden)] pub owners: HashSet<UserId>,
#[doc(hidden)] pub prefixes: Vec<String>,
+ #[doc(hidden)] pub no_prefix: bool,
#[doc(hidden)] pub delimiters: Vec<String>,
#[doc(hidden)] pub case_insensitive: bool,
}
@@ -398,6 +399,16 @@ impl Configuration {
self
}
+ /// Sets whether command execution can done without a prefix. Works only in private channels.
+ ///
+ /// # Note
+ /// Needs the `cache` feature to be enabled. Otherwise this does nothing.
+ pub fn no_prefix(mut self, b: bool) -> Self {
+ self.no_prefix = b;
+
+ self
+ }
+
/// Sets a delimiter to be used when splitting the content after a command.
///
/// # Examples
@@ -466,6 +477,7 @@ impl Default for Configuration {
/// - **depth** to `5`
/// - **on_mention** to `false` (basically)
/// - **prefix** to `None`
+ /// - **no_prefix** to `false`
/// - **delimiters** to vec![" "]
/// - **case_insensitive** to `false`
fn default() -> Configuration {
@@ -475,6 +487,7 @@ impl Default for Configuration {
dynamic_prefix: None,
allow_whitespace: false,
prefixes: vec![],
+ no_prefix: false,
ignore_bots: true,
owners: HashSet::default(),
blocked_users: HashSet::default(),