Some fixing stuff lol

This commit is contained in:
Hirrolot 2022-04-02 15:34:43 +06:00
parent 18651a8253
commit 5000c4cec4
3 changed files with 6 additions and 6 deletions

View file

@ -1,7 +1,7 @@
use std::{error::Error, str::FromStr}; use std::{error::Error, str::FromStr};
use chrono::Duration; use chrono::Duration;
use teloxide::{prelude::*, types::ChatPermissions, utils::command::BotCommand}; use teloxide::{prelude::*, types::ChatPermissions, utils::command::BotCommands};
// Derive BotCommands to parse text with a command into this enumeration. // Derive BotCommands to parse text with a command into this enumeration.
// //
@ -72,7 +72,7 @@ async fn action(
) -> Result<(), Box<dyn Error + Send + Sync>> { ) -> Result<(), Box<dyn Error + Send + Sync>> {
match command { match command {
Command::Help => { Command::Help => {
bot.send_message(msg.chat.id, Command::descriptions()).await?; bot.send_message(msg.chat.id, Command::descriptions().to_string()).await?;
} }
Command::Kick => kick_user(bot, msg).await?, Command::Kick => kick_user(bot, msg).await?,
Command::Ban { time, unit } => ban_user(bot, msg, calc_restrict_time(time, unit)).await?, Command::Ban { time, unit } => ban_user(bot, msg, calc_restrict_time(time, unit)).await?,

View file

@ -6,7 +6,7 @@ use rand::Rng;
use teloxide::{ use teloxide::{
prelude::*, prelude::*,
types::{Dice, Update}, types::{Dice, Update},
utils::command::BotCommand, utils::command::BotCommands,
}; };
#[tokio::main] #[tokio::main]
@ -122,7 +122,7 @@ async fn simple_commands_handler(
bot: AutoSend<Bot>, bot: AutoSend<Bot>,
cmd: SimpleCommand, cmd: SimpleCommand,
cfg: ConfigParameters, cfg: ConfigParameters,
me: Me, me: teloxide::types::Me,
) -> Result<(), teloxide::RequestError> { ) -> Result<(), teloxide::RequestError> {
let text = match cmd { let text = match cmd {
SimpleCommand::Help => { SimpleCommand::Help => {

View file

@ -1,4 +1,4 @@
use teloxide::{prelude::*, utils::command::BotCommand}; use teloxide::{prelude::*, utils::command::BotCommands};
use std::error::Error; use std::error::Error;
@ -12,7 +12,7 @@ async fn main() {
teloxide::commands_repl(bot, answer, Command::ty()).await; teloxide::commands_repl(bot, answer, Command::ty()).await;
} }
#[derive(BotCommand, Clone)] #[derive(BotCommands, Clone)]
#[command(rename = "lowercase", description = "These commands are supported:")] #[command(rename = "lowercase", description = "These commands are supported:")]
enum Command { enum Command {
#[command(description = "display this text.")] #[command(description = "display this text.")]