diff options
| author | acdenisSK <[email protected]> | 2017-09-01 19:21:38 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-09-01 19:21:38 +0200 |
| commit | deee38d87d71a918b6d8270dbfaffeb0a7234508 (patch) | |
| tree | c1d5e3c92fc43ba50e3245192d1531b1945d50d4 /src/framework/standard/configuration.rs | |
| parent | Add num_args (#156) (diff) | |
| download | serenity-deee38d87d71a918b6d8270dbfaffeb0a7234508.tar.xz serenity-deee38d87d71a918b6d8270dbfaffeb0a7234508.zip | |
Add case insensitivity
Diffstat (limited to 'src/framework/standard/configuration.rs')
| -rw-r--r-- | src/framework/standard/configuration.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/framework/standard/configuration.rs b/src/framework/standard/configuration.rs index 491bbc4..611e748 100644 --- a/src/framework/standard/configuration.rs +++ b/src/framework/standard/configuration.rs @@ -59,6 +59,8 @@ pub struct Configuration { pub prefixes: Vec<String>, #[doc(hidden)] pub delimiters: Vec<String>, + #[doc(hidden)] + pub case_insensitive: bool, } impl Configuration { @@ -421,6 +423,14 @@ impl Configuration { self } + + /// Whether the framework shouldn't care about the user's input if it's: `~command`, `~Command`, `~COMMAND`. + /// Setting this to `true` will result in *all* command names to be case insensitive. + pub fn case_insensitivity(mut self, cs: bool) -> Self { + self.case_insensitive = cs; + + self + } } impl Default for Configuration { @@ -431,6 +441,7 @@ impl Default for Configuration { /// - **on_mention** to `false` (basically) /// - **prefix** to `None` /// - **delimiters** to vec![" "] + /// - **case_insensitive** to `false` fn default() -> Configuration { Configuration { depth: 5, @@ -445,6 +456,7 @@ impl Default for Configuration { disabled_commands: HashSet::default(), allow_dm: true, ignore_webhooks: true, + case_insensitive: false, delimiters: vec![" ".to_string()], } } |