Reapply improved
This commit is contained in:
parent
8beb33b7c3
commit
de552db4c8
@ -83,13 +83,30 @@ async def callback_query_reapply_reject(app: Client, clb: CallbackQuery):
|
|||||||
# Use old application when user reapplies after leaving the chat
|
# Use old application when user reapplies after leaving the chat
|
||||||
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
||||||
async def callback_query_reapply_old(app: Client, clb: CallbackQuery):
|
async def callback_query_reapply_old(app: Client, clb: CallbackQuery):
|
||||||
fullclb = clb.data.split("_")
|
|
||||||
|
|
||||||
if HoloUser(clb.from_user).sponsorship_state()[0] == "fill":
|
fullclb = clb.data.split("_")
|
||||||
|
holo_user = HoloUser(clb.from_user)
|
||||||
|
|
||||||
|
if holo_user.sponsorship_state()[0] == "fill":
|
||||||
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False)
|
await clb.message.reply_text(locale("finish_sponsorship", "message"), quote=False)
|
||||||
return
|
return
|
||||||
|
|
||||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||||
|
|
||||||
|
if col_tmp.find_one({"user": holo_user.id, "type": "application"}) is None and col_applications.find_one({"user": holo_user.id}) is not None:
|
||||||
|
col_tmp.insert_one(
|
||||||
|
{
|
||||||
|
"user": holo_user.id,
|
||||||
|
"type": "application",
|
||||||
|
"complete": True,
|
||||||
|
"sent": False,
|
||||||
|
"state": "fill",
|
||||||
|
"reapply": True,
|
||||||
|
"stage": 10,
|
||||||
|
"application": col_applications.find_one({"user": holo_user.id})["application"]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
await confirm_yes(app, message, kind="application")
|
await confirm_yes(app, message, kind="application")
|
||||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button", locale=clb.from_user), "nothing")]]))
|
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button", locale=clb.from_user), "nothing")]]))
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ from classes.holo_user import HoloUser
|
|||||||
from modules.logging import logWrite
|
from modules.logging import logWrite
|
||||||
from modules.utils import configGet, locale, should_quote
|
from modules.utils import configGet, locale, should_quote
|
||||||
from modules.handlers.welcome import welcome_pass
|
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
|
from modules import custom_filters
|
||||||
|
|
||||||
# Reapply command ==============================================================================================================
|
# Reapply command ==============================================================================================================
|
||||||
@ -27,16 +27,20 @@ async def cmd_reapply(app: Client, msg: Message):
|
|||||||
if member.user.id == msg.from_user.id:
|
if member.user.id == msg.from_user.id:
|
||||||
left_chat = False
|
left_chat = False
|
||||||
|
|
||||||
if not left_chat:
|
if left_chat is True:
|
||||||
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 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([
|
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)
|
holo_user.application_restart(reapply=True)
|
||||||
await welcome_pass(app, msg, once_again=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:
|
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([
|
await msg.reply_text(locale("reapply_in_progress", "message", locale=holo_user).format(locale("confirm", "keyboard", locale=holo_user)[1][0]), reply_markup=InlineKeyboardMarkup([
|
||||||
|
@ -30,7 +30,10 @@ async def welcome_pass(app: Client, msg: Message, once_again: bool = False) -> N
|
|||||||
if once_again is False:
|
if once_again is False:
|
||||||
holo_user.application_restart()
|
holo_user.application_restart()
|
||||||
|
|
||||||
logWrite(f"User {msg.from_user.id} confirmed starting the application")
|
if once_again is True:
|
||||||
|
logWrite(f"User {msg.from_user.id} confirmed starting the application")
|
||||||
|
else:
|
||||||
|
logWrite(f"User {msg.from_user.id} confirmed starting the application once again")
|
||||||
await msg.reply_text(locale("question1", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("question1", "force_reply", locale=msg.from_user)))
|
await msg.reply_text(locale("question1", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("question1", "force_reply", locale=msg.from_user)))
|
||||||
|
|
||||||
welcome_2 = []
|
welcome_2 = []
|
||||||
|
Reference in New Issue
Block a user