aboutsummaryrefslogtreecommitdiff
path: root/src/framework/configuration.rs
diff options
context:
space:
mode:
authorLakelezz <[email protected]>2017-08-13 15:13:13 +0200
committeralex <[email protected]>2017-08-13 15:13:13 +0200
commit069df4f85d8c462df58c1fce00595462f2825337 (patch)
treefdfc25d1942f3ededc0d4b87b03396318b46e564 /src/framework/configuration.rs
parentTrim a second time for a sake (diff)
downloadserenity-069df4f85d8c462df58c1fce00595462f2825337.tar.xz
serenity-069df4f85d8c462df58c1fce00595462f2825337.zip
Fix string delimiters (#134)
Diffstat (limited to 'src/framework/configuration.rs')
-rw-r--r--src/framework/configuration.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/framework/configuration.rs b/src/framework/configuration.rs
index a6d0440..2854d90 100644
--- a/src/framework/configuration.rs
+++ b/src/framework/configuration.rs
@@ -58,7 +58,7 @@ pub struct Configuration {
#[doc(hidden)]
pub prefixes: Vec<String>,
#[doc(hidden)]
- pub delimeters: Vec<String>,
+ pub delimiters: Vec<String>,
}
impl Configuration {
@@ -370,7 +370,7 @@ impl Configuration {
self
}
- /// Sets a delimeter to be used when splitting the content after a command.
+ /// Sets a delimiter to be used when splitting the content after a command.
///
/// # Examples
///
@@ -386,15 +386,16 @@ impl Configuration {
/// use serenity::framework::BuiltinFramework;
///
/// client.with_framework(BuiltinFramework::new().configure(|c| c
- /// .delimeter(", ")));
+ /// .delimiter(", ")));
/// ```
- pub fn delimeter(mut self, delimeter: &str) -> Self {
- self.delimeters.push(delimeter.to_string());
+ pub fn delimiter(mut self, delimiter: &str) -> Self {
+ self.delimiters.push(delimiter.to_string());
self
}
- /// Sets multiple delimeters to be used when splitting the content after a command.
+ /// Sets multiple delimiters to be used when splitting the content after a command.
+ /// Additionally cleans the default delimiter from the vector.
///
/// # Examples
///
@@ -410,10 +411,11 @@ impl Configuration {
/// use serenity::framework::BuiltinFramework;
///
/// client.with_framework(BuiltinFramework::new().configure(|c| c
- /// .delimeters(vec![", ", " "])));
+ /// .delimiters(vec![", ", " "])));
/// ```
- pub fn delimeters(mut self, delimeters: Vec<&str>) -> Self {
- self.delimeters.extend(delimeters.into_iter().map(|s| s.to_string()));
+ pub fn delimiters(mut self, delimiters: Vec<&str>) -> Self {
+ self.delimiters.clear();
+ self.delimiters.extend(delimiters.into_iter().map(|s| s.to_string()));
self
}
@@ -426,7 +428,7 @@ impl Default for Configuration {
/// - **depth** to `5`
/// - **on_mention** to `false` (basically)
/// - **prefix** to `None`
- /// - **delimeters** to vec![" "]
+ /// - **delimiters** to vec![" "]
fn default() -> Configuration {
Configuration {
depth: 5,
@@ -441,7 +443,7 @@ impl Default for Configuration {
disabled_commands: HashSet::default(),
allow_dm: true,
ignore_webhooks: true,
- delimeters: vec![" ".to_string()],
+ delimiters: vec![" ".to_string()],
}
}
}