Fix examples/admin_bot, examples/simple_commands_bot

This commit is contained in:
Hirrolot 2022-01-28 21:04:05 +06:00
parent 2058395d54
commit 0a6487c23c
2 changed files with 3 additions and 13 deletions

View file

@ -1,11 +1,7 @@
use std::{error::Error, str::FromStr};
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
use teloxide::{
prelude2::*,
types::{ChatPermissions, Me},
utils::command::BotCommand,
};
use teloxide::{prelude2::*, types::ChatPermissions, utils::command::BotCommand};
// Derive BotCommand to parse text with a command into this enumeration.
//
@ -160,7 +156,5 @@ async fn main() {
let bot = Bot::from_env().auto_send();
let Me { user: bot_user, .. } = bot.get_me().await.unwrap();
let bot_name = bot_user.username.expect("Bots must have usernames");
teloxide::repls2::commands_repl(bot, bot_name, action, Command::ty()).await;
teloxide::repls2::commands_repl(bot, action, Command::ty()).await;
}

View file

@ -1,7 +1,6 @@
use teloxide::{prelude2::*, utils::command::BotCommand};
use std::error::Error;
use teloxide::types::Me;
#[derive(BotCommand, Clone)]
#[command(rename = "lowercase", description = "These commands are supported:")]
@ -43,8 +42,5 @@ async fn main() {
let bot = Bot::from_env().auto_send();
let Me { user: bot_user, .. } = bot.get_me().await.unwrap();
let bot_name = bot_user.username.expect("Bots must have usernames");
teloxide::repls2::commands_repl(bot, bot_name, answer, Command::ty()).await;
teloxide::repls2::commands_repl(bot, answer, Command::ty()).await;
}