Skip to content

Commit

Permalink
Use ~ as a default command prefix (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miezhiko authored Oct 28, 2020
1 parent 0d9b821 commit d9e9bf7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/framework/standard/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ impl Configuration {
/// Sets the prefix to respond to. A prefix can be a string slice of any
/// non-zero length.
///
/// **Note**: Defaults to an empty vector.
/// **Note**: Defaults to "~".
///
/// **Note**: Passing empty string `""` will set no prefix.
///
/// # Examples
///
Expand All @@ -417,7 +419,11 @@ impl Configuration {
/// .prefix("!"));
/// ```
pub fn prefix(&mut self, prefix: &str) -> &mut Self {
self.prefixes = vec![prefix.to_string()];
self.prefixes = if prefix.is_empty() {
vec![]
} else {
vec![prefix.to_string()]
};

self
}
Expand Down Expand Up @@ -551,7 +557,7 @@ impl Default for Configuration {
/// - **no_dm_prefix** to `false`
/// - **on_mention** to `false`
/// - **owners** to an empty HashSet
/// - **prefix** to an empty vector
/// - **prefix** to "~"
fn default() -> Configuration {
Configuration {
allow_dm: true,
Expand All @@ -569,7 +575,7 @@ impl Default for Configuration {
no_dm_prefix: false,
on_mention: None,
owners: HashSet::default(),
prefixes: vec![],
prefixes: vec![String::from("~")],
}
}
}

0 comments on commit d9e9bf7

Please sign in to comment.