mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-25 16:12:06 +01:00
Fix examples/admin_bot
, examples/simple_commands_bot
This commit is contained in:
parent
2058395d54
commit
0a6487c23c
2 changed files with 3 additions and 13 deletions
|
@ -1,11 +1,7 @@
|
||||||
use std::{error::Error, str::FromStr};
|
use std::{error::Error, str::FromStr};
|
||||||
|
|
||||||
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
|
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
|
||||||
use teloxide::{
|
use teloxide::{prelude2::*, types::ChatPermissions, utils::command::BotCommand};
|
||||||
prelude2::*,
|
|
||||||
types::{ChatPermissions, Me},
|
|
||||||
utils::command::BotCommand,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Derive BotCommand to parse text with a command into this enumeration.
|
// 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 bot = Bot::from_env().auto_send();
|
||||||
|
|
||||||
let Me { user: bot_user, .. } = bot.get_me().await.unwrap();
|
teloxide::repls2::commands_repl(bot, action, Command::ty()).await;
|
||||||
let bot_name = bot_user.username.expect("Bots must have usernames");
|
|
||||||
teloxide::repls2::commands_repl(bot, bot_name, action, Command::ty()).await;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use teloxide::{prelude2::*, utils::command::BotCommand};
|
use teloxide::{prelude2::*, utils::command::BotCommand};
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use teloxide::types::Me;
|
|
||||||
|
|
||||||
#[derive(BotCommand, Clone)]
|
#[derive(BotCommand, Clone)]
|
||||||
#[command(rename = "lowercase", description = "These commands are supported:")]
|
#[command(rename = "lowercase", description = "These commands are supported:")]
|
||||||
|
@ -43,8 +42,5 @@ async fn main() {
|
||||||
|
|
||||||
let bot = Bot::from_env().auto_send();
|
let bot = Bot::from_env().auto_send();
|
||||||
|
|
||||||
let Me { user: bot_user, .. } = bot.get_me().await.unwrap();
|
teloxide::repls2::commands_repl(bot, answer, Command::ty()).await;
|
||||||
let bot_name = bot_user.username.expect("Bots must have usernames");
|
|
||||||
|
|
||||||
teloxide::repls2::commands_repl(bot, bot_name, answer, Command::ty()).await;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue