Reapply improved

This commit is contained in:
2023-01-16 12:10:07 +01:00
parent 8beb33b7c3
commit de552db4c8
3 changed files with 46 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ from classes.holo_user import HoloUser
from modules.logging import logWrite
from modules.utils import configGet, locale, should_quote
from modules.handlers.welcome import welcome_pass
from modules.database import col_tmp
from modules.database import col_tmp, col_applications
from modules import custom_filters
# Reapply command ==============================================================================================================
@@ -27,16 +27,20 @@ async def cmd_reapply(app: Client, msg: Message):
if member.user.id == msg.from_user.id:
left_chat = False
if not left_chat:
if holo_user.sponsorship_state()[0] == "fill":
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
return
holo_user.application_restart(reapply=True)
await welcome_pass(app, msg, once_again=True)
else:
if left_chat is True:
if holo_user.application_state()[1] is True and holo_user.application_state()[0] != "fill":
if (holo_user.application_state()[1] is True and holo_user.application_state()[0] != "fill"):
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
[
InlineKeyboardButton(locale("reapply_old_one", "button", locale=holo_user), f"reapply_old_{msg.id}")
],
[
InlineKeyboardButton(locale("reapply_new_one", "button", locale=holo_user), f"reapply_new_{msg.id}")
]
]))
elif col_tmp.find_one({"user": holo_user.id, "type": "application"}) is None and col_applications.find_one({"user": holo_user.id}) is not None:
await msg.reply_text(locale("reapply_left_chat", "message", locale=holo_user), reply_markup=InlineKeyboardMarkup([
[
@@ -52,6 +56,15 @@ async def cmd_reapply(app: Client, msg: Message):
holo_user.application_restart(reapply=True)
await welcome_pass(app, msg, once_again=True)
else:
if holo_user.sponsorship_state()[0] == "fill":
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
return
holo_user.application_restart(reapply=True)
await welcome_pass(app, msg, once_again=True)
else:
await msg.reply_text(locale("reapply_in_progress", "message", locale=holo_user).format(locale("confirm", "keyboard", locale=holo_user)[1][0]), reply_markup=InlineKeyboardMarkup([