Minor fixes

This commit is contained in:
StNicolay 2024-05-12 17:03:40 +03:00
parent aa3c2ae313
commit 064ec22e51
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
3 changed files with 8 additions and 5 deletions

View File

@ -20,7 +20,11 @@ pub fn get_dispatcher(
token: String, token: String,
db: Pool, db: Pool,
) -> Dispatcher<Throttle<Bot>, crate::Error, DefaultKey> { ) -> Dispatcher<Throttle<Bot>, crate::Error, DefaultKey> {
let bot = Bot::new(token).throttle(Limits::default()); let client = teloxide::net::default_reqwest_settings()
.https_only(true)
.build()
.expect("Failed to create reqwest Client");
let bot = Bot::with_client(token, client).throttle(Limits::default());
let command_handler = filter_command::<Command, _>() let command_handler = filter_command::<Command, _>()
.branch(case![Command::Start].endpoint(commands::start)) .branch(case![Command::Start].endpoint(commands::start))
@ -66,8 +70,7 @@ pub fn get_dispatcher(
.branch(case![CallbackCommand::Alter(hash, field)].endpoint(callbacks::alter)) .branch(case![CallbackCommand::Alter(hash, field)].endpoint(callbacks::alter))
.chain(case![CallbackCommand::ChangeLocale(locale)].endpoint(callbacks::change_locale)); .chain(case![CallbackCommand::ChangeLocale(locale)].endpoint(callbacks::change_locale));
let handler = dptree::entry() let handler = dptree::map_async(locales::Locale::from_update)
.map_async(locales::Locale::from_update)
.enter_dialogue::<Update, InMemStorage<State>, State>() .enter_dialogue::<Update, InMemStorage<State>, State>()
.branch(message_handler) .branch(message_handler)
.chain(callback_handler); .chain(callback_handler);

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Deletes the message without returining errors /// Deletes the message without returning errors
#[inline] #[inline]
pub async fn delete_message(bot: Throttle<Bot>, msg: Message) { pub async fn delete_message(bot: Throttle<Bot>, msg: Message) {
let ids = MessageIds::from(&msg); let ids = MessageIds::from(&msg);

View File

@ -131,7 +131,7 @@ fn process_accounts(
)?; )?;
} }
error_text.push_str(&locale.fix_that_and_send_again); write!(error_text, "\n{}", locale.fix_that_and_send_again)?;
Ok(Err(error_text)) Ok(Err(error_text))
} }