Added support for multiple languages

This commit is contained in:
2024-04-16 16:02:48 +03:00
parent aded63f9d5
commit c5855fced7
52 changed files with 973 additions and 409 deletions

View File

@@ -1,19 +1,24 @@
use crate::prelude::*;
#[inline]
pub async fn menu(bot: Throttle<Bot>, msg: Message, db: Pool) -> crate::Result<()> {
pub async fn menu(
bot: Throttle<Bot>,
msg: Message,
db: Pool,
locale: LocaleRef,
) -> crate::Result<()> {
let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
let markup = menu_markup("get", user_id, &db).await?;
if markup.inline_keyboard.is_empty() {
bot.send_message(msg.chat.id, "You don't have any accounts")
.reply_markup(deletion_markup())
bot.send_message(msg.chat.id, locale.no_accounts_found.as_ref())
.reply_markup(deletion_markup(locale))
.await?;
return Ok(());
}
bot.send_message(msg.chat.id, "Choose your account")
bot.send_message(msg.chat.id, locale.choose_account.as_ref())
.reply_markup(markup)
.await?;
Ok(())