fixed strings in todo commands. improved clarity of main.rs. improved the signature of RegexFramework::new()

This commit is contained in:
2020-10-12 18:37:14 +01:00
parent 09a7608429
commit 3756e462e0
3 changed files with 103 additions and 25 deletions

View File

@@ -186,13 +186,13 @@ impl SendIterator for ChannelId {
}
impl RegexFramework {
pub fn new(client_id: u64) -> Self {
pub fn new<T: Into<u64>>(client_id: T) -> Self {
Self {
commands: HashMap::new(),
command_matcher: Regex::new(r#"^$"#).unwrap(),
dm_regex_matcher: Regex::new(r#"^$"#).unwrap(),
default_prefix: env::var("DEFAULT_PREFIX").unwrap_or_else(|_| PREFIX.to_string()),
client_id,
client_id: client_id.into(),
ignore_bots: true,
}
}
@@ -209,7 +209,7 @@ impl RegexFramework {
self
}
pub fn add_command(mut self, name: &str, command: &'static Command) -> Self {
pub fn add_command<S: ToString>(mut self, name: S, command: &'static Command) -> Self {
self.commands.insert(name.to_string(), command);
self