/cancel, /identify, sponsorships improvements and fixes #3
@ -13,18 +13,25 @@ async def cmd_reapply(app: Client, msg: Message):
|
|||||||
|
|
||||||
holo_user = HoloUser(msg.from_user)
|
holo_user = HoloUser(msg.from_user)
|
||||||
|
|
||||||
if holo_user.application_state()[0] in ["approved", "rejected"]:
|
# Check if user has approved/rejected tmp application
|
||||||
if (holo_user.application_state()[1] is True) and (not col_tmp.find_one({"user": holo_user.id, "type": "application"})["sent"]):
|
if (holo_user.application_state()[0] in ["approved", "rejected"]) or (holo_user.application_state()[0] == "none"):
|
||||||
|
|
||||||
|
# Check if user's tmp application is already completed or even sent
|
||||||
|
if ((holo_user.application_state()[1] is True) and (not col_tmp.find_one({"user": holo_user.id, "type": "application"})["sent"])) or (holo_user.application_state()[0] == "none"):
|
||||||
|
|
||||||
left_chat = True
|
left_chat = True
|
||||||
|
|
||||||
async for member in app.get_chat_members(configGet("destination_group")):
|
async for member in app.get_chat_members(configGet("destination_group")):
|
||||||
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 not left_chat:
|
||||||
if holo_user.sponsorship_state()[0] == "fill":
|
if holo_user.sponsorship_state()[0] == "fill":
|
||||||
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
|
await msg.reply_text(locale("finish_sponsorship", "message"), quote=should_quote(msg))
|
||||||
return
|
return
|
||||||
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:
|
else:
|
||||||
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([
|
||||||
[
|
[
|
||||||
@ -34,15 +41,20 @@ async def cmd_reapply(app: Client, msg: Message):
|
|||||||
InlineKeyboardButton(locale("reapply_new_one", "button", locale=holo_user), f"reapply_new_{msg.id}")
|
InlineKeyboardButton(locale("reapply_new_one", "button", locale=holo_user), f"reapply_new_{msg.id}")
|
||||||
]
|
]
|
||||||
]))
|
]))
|
||||||
|
|
||||||
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([
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(locale("applying_stop", "button", locale=holo_user), f"reapply_stop_{msg.id}")
|
InlineKeyboardButton(locale("applying_stop", "button", locale=holo_user), f"reapply_stop_{msg.id}")
|
||||||
]
|
]
|
||||||
]))
|
]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if (holo_user.application_state()[0] == "fill") and (col_tmp.find_one({"user": holo_user.id, "type": "application"})["sent"] is True):
|
if (holo_user.application_state()[0] == "fill") and (col_tmp.find_one({"user": holo_user.id, "type": "application"})["sent"] is True):
|
||||||
await msg.reply_text(locale("reapply_forbidden", "message", locale=holo_user))
|
await msg.reply_text(locale("reapply_forbidden", "message", locale=holo_user))
|
||||||
|
|
||||||
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([
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user