mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Merge pull request #35 from teloxide/bot_name_and_str
adapt to teloxide changes
This commit is contained in:
commit
5d6cce4121
2 changed files with 3 additions and 6 deletions
|
@ -18,4 +18,4 @@ heck = "0.4.0"
|
|||
|
||||
[dev-dependencies]
|
||||
# XXX: Do not enable `macros` feature
|
||||
teloxide = { git = "https://github.com/teloxide/teloxide.git", rev = "4246455" }
|
||||
teloxide = { git = "https://github.com/teloxide/teloxide.git", rev = "b5e237a8a22f9f987b6e4245b9b6c3ca1f804c19" }
|
||||
|
|
|
@ -102,10 +102,7 @@ fn impl_parse(
|
|||
let matching_values = infos.iter().map(|c| c.get_prefixed_command());
|
||||
|
||||
quote! {
|
||||
fn parse<N>(s: &str, bot_name: N) -> Result<Self, teloxide::utils::command::ParseError>
|
||||
where
|
||||
N: Into<String>
|
||||
{
|
||||
fn parse(s: &str, bot_name: &str) -> Result<Self, teloxide::utils::command::ParseError> {
|
||||
// FIXME: we should probably just call a helper function from `teloxide`, instead of parsing command syntax ourselves
|
||||
use std::str::FromStr;
|
||||
use teloxide::utils::command::ParseError;
|
||||
|
@ -121,7 +118,7 @@ fn impl_parse(
|
|||
let bot_username = full_command.next();
|
||||
match bot_username {
|
||||
None => {}
|
||||
Some(username) if username.eq_ignore_ascii_case(&bot_name.into()) => {}
|
||||
Some(username) if username.eq_ignore_ascii_case(bot_name) => {}
|
||||
Some(n) => return Err(ParseError::WrongBotName(n.to_owned())),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue