mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Refactor
This commit is contained in:
@@ -137,14 +137,9 @@ async fn send_with_download_from_channel(
|
|||||||
) -> BotHandlerInternal {
|
) -> BotHandlerInternal {
|
||||||
match download_file(&download_data).await {
|
match download_file(&download_data).await {
|
||||||
Ok(v) => {
|
Ok(v) => {
|
||||||
match _send_downloaded_file(&message, bot.clone(), v).await {
|
if let Err(_) = _send_downloaded_file(&message, bot.clone(), v).await {
|
||||||
Ok(_) => (),
|
send_download_link(message.clone(), bot.clone(), download_data).await?;
|
||||||
Err(err) => {
|
return Ok(());
|
||||||
log::error!("{:?}", err);
|
|
||||||
|
|
||||||
send_download_link(message.clone(), bot.clone(), download_data).await?;
|
|
||||||
return Ok(());
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if need_delete_message {
|
if need_delete_message {
|
||||||
|
|||||||
9
src/bots/approved_bot/modules/help/commands.rs
Normal file
9
src/bots/approved_bot/modules/help/commands.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
use teloxide::utils::command::BotCommands;
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(BotCommands, Clone)]
|
||||||
|
#[command(rename_rule = "lowercase")]
|
||||||
|
pub enum HelpCommand {
|
||||||
|
Start,
|
||||||
|
Help,
|
||||||
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
|
pub mod commands;
|
||||||
|
|
||||||
use crate::bots::BotHandlerInternal;
|
use crate::bots::BotHandlerInternal;
|
||||||
|
|
||||||
use teloxide::{prelude::*, utils::command::BotCommands, types::ParseMode, adaptors::{Throttle, CacheMe}};
|
use teloxide::{prelude::*, types::ParseMode, adaptors::{Throttle, CacheMe}};
|
||||||
|
|
||||||
#[derive(BotCommands, Clone)]
|
use self::commands::HelpCommand;
|
||||||
#[command(rename_rule = "lowercase")]
|
|
||||||
enum HelpCommand {
|
|
||||||
Start,
|
|
||||||
Help,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub async fn help_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
|
pub async fn help_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
|
||||||
Reference in New Issue
Block a user