diff --git a/src/bot/mod.rs b/src/bot/mod.rs index d4e6d884..6c7dbcc2 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -11,28 +11,35 @@ pub struct Bot { client: Client, } -/// Constructors impl Bot { - pub fn new(token: &str) -> Self { + pub fn new(token: S) -> Self + where + S: Into, + { Bot { - token: String::from(token), + token: token.into(), client: Client::new(), } } - pub fn with_client(token: &str, client: Client) -> Self { + pub fn with_client(token: S, client: Client) -> Self + where + S: Into, + { Bot { - token: String::from(token), + token: token.into(), client, } } } impl Bot { + #[inline] pub fn token(&self) -> &str { &self.token } + #[inline] pub fn client(&self) -> &Client { &self.client }