Locale usage fixes

This commit is contained in:
Profitroll 2022-12-28 19:01:21 +01:00
parent 22011829a5
commit c763fc537b
4 changed files with 9 additions and 9 deletions

View File

@ -528,7 +528,7 @@ class HoloUser():
return
progress["sponsorship"]["label"] = query
col_tmp.update_one({"user": {"$eq": self.id}, "type": {"$eq": "sponsorship"}}, {"$set": {"sponsorship": progress["sponsorship"], "complete": True}})
await msg.reply_text(locale("sponsor_confirm", "message"), reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboard", locale=self.locale), resize_keyboard=True))
await msg.reply_text(locale("sponsor_confirm", "message", locale=self.locale), reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboard", locale=self.locale), resize_keyboard=True))
else:
return

View File

@ -24,9 +24,9 @@ async def callback_query_sponsor_apply(app: Client, clb: CallbackQuery):
edited_markup = [[InlineKeyboardButton(text=str(locale("sponsor_started", "button")), callback_data="nothing")]]
await clb.message.edit(text=locale("sponsorship_applying", "message"), reply_markup=InlineKeyboardMarkup(edited_markup))
await app.send_message(holo_user.id, locale(f"sponsor1", "message", locale=holo_user.locale), reply_markup=ForceReply(placeholder=str(locale(f"sponsor1", "force_reply", locale=holo_user.locale))))
await clb.answer(text=locale("sponsor_started", "callback").format(holo_user.id), show_alert=False)
await clb.message.edit(text=locale("sponsorship_applying", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup(edited_markup))
await app.send_message(holo_user.id, locale(f"sponsor1", "message", locale=holo_user), reply_markup=ForceReply(placeholder=str(locale(f"sponsor1", "force_reply", locale=holo_user.locale))))
await clb.answer(text=locale("sponsor_started", "callback", locale=holo_user).format(holo_user.id), show_alert=False)
@app.on_callback_query(filters.regex("sponsor_yes_[\s\S]*"))
async def callback_query_sponsor_yes(app: Client, clb: CallbackQuery):

View File

@ -17,7 +17,7 @@ async def cmd_nearby(app: Client, msg: Message):
if len(msg.command) < 2:
application = col_applications.find_one({"user": msg.from_user})
if application is None:
await msg.reply_text(locale("nearby_user_empty", "message", locale=holo_user.locale))
await msg.reply_text(locale("nearby_user_empty", "message", locale=holo_user))
return
location = application["application"]["3"]["loc"][0], application["application"]["3"]["loc"][1]
else:
@ -25,10 +25,10 @@ async def cmd_nearby(app: Client, msg: Message):
location_coordinates = find_location(" ".join(msg.command[2:]))
location = location_coordinates["lng"], location_coordinates["lat"]
except PlaceNotFoundError:
await msg.reply_text(locale("nearby_invalid", "message", locale=holo_user.locale), quote=should_quote(msg))
await msg.reply_text(locale("nearby_invalid", "message", locale=holo_user), quote=should_quote(msg))
return
except Exception as exp:
await msg.reply_text(locale("nearby_error", "message", locale=holo_user.locale), quote=should_quote(msg))
await msg.reply_text(locale("nearby_error", "message", locale=holo_user), quote=should_quote(msg))
return
output = []

View File

@ -11,9 +11,9 @@ from modules.database import col_applications
@app.on_message(~ filters.scheduled & (custom_filters.allowed | custom_filters.admin) & filters.command(["sponsorship"], prefixes=["/"]))
async def cmd_sponsorship(app: Client, msg: Message):
if HoloUser(msg.from_user).application_state()[0] == "fill":
await msg.reply_text(locale("finish_application", "message"), quote=should_quote(msg))
await msg.reply_text(locale("finish_application", "message", locale=msg.from_user), quote=should_quote(msg))
return
await msg.reply_text(locale("sponsorship_apply", "message"), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text=str(locale("sponsor_apply", "button")), callback_data=f"sponsor_apply_{msg.from_user.id}")]]), quote=should_quote(msg))
await msg.reply_text(locale("sponsorship_apply", "message", locale=msg.from_user), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text=str(locale("sponsor_apply", "button", locale=msg.from_user)), callback_data=f"sponsor_apply_{msg.from_user.id}")]]), quote=should_quote(msg))
# else:
# await msg.reply_text(locale("sponsorship_application_empty", "message"))
# ==============================================================================================================================