mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Make BotCommands::parse
accept bot username as &str
Former-commit-id: 8dfb5268be
This commit is contained in:
parent
b061a21881
commit
466900ee46
2 changed files with 2 additions and 4 deletions
|
@ -90,6 +90,6 @@ where
|
||||||
{
|
{
|
||||||
dptree::entry().chain(dptree::filter_map(move |message: Message, me: Me| {
|
dptree::entry().chain(dptree::filter_map(move |message: Message, me: Me| {
|
||||||
let bot_name = me.user.username.expect("Bots must have a username");
|
let bot_name = me.user.username.expect("Bots must have a username");
|
||||||
message.text().and_then(|text| C::parse(text, bot_name).ok())
|
message.text().and_then(|text| C::parse(text, &bot_name).ok())
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,7 @@ pub trait BotCommands: Sized {
|
||||||
///
|
///
|
||||||
/// `bot_username` is required to parse commands like
|
/// `bot_username` is required to parse commands like
|
||||||
/// `/cmd@username_of_the_bot`.
|
/// `/cmd@username_of_the_bot`.
|
||||||
fn parse<N>(s: &str, bot_username: N) -> Result<Self, ParseError>
|
fn parse(s: &str, bot_username: &str) -> Result<Self, ParseError>;
|
||||||
where
|
|
||||||
N: Into<String>;
|
|
||||||
|
|
||||||
/// Returns descriptions of the commands suitable to be shown to the user
|
/// Returns descriptions of the commands suitable to be shown to the user
|
||||||
/// (for example when `/help` command is used).
|
/// (for example when `/help` command is used).
|
||||||
|
|
Loading…
Reference in a new issue