adapt to teloxide changes

This commit is contained in:
Maybe Waffle 2022-10-05 09:58:25 +04:00
parent 3d3e3eb310
commit a2a79e29cb
2 changed files with 3 additions and 6 deletions

View file

@ -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" }

View file

@ -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())),
}