Modularity overhaul
This commit is contained in:
45
modules/commands/reapply.py
Normal file
45
modules/commands/reapply.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from app import app
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from modules.utils import configGet, configSet, locale
|
||||
from modules.handlers.welcome import welcome_pass
|
||||
|
||||
# Reapply command ==============================================================================================================
|
||||
@app.on_message(~ filters.scheduled & filters.private & filters.command(["reapply"], prefixes=["/"]))
|
||||
async def cmd_reapply(app, msg):
|
||||
|
||||
if configGet("approved", file=str(msg.from_user.id)) or configGet("refused", file=str(msg.from_user.id)):
|
||||
if (configGet("stage", file=str(msg.from_user.id)) == 10) and not (configGet("sent", file=str(msg.from_user.id))):
|
||||
left_chat = True
|
||||
async for member in app.get_chat_members(configGet("destination_group")):
|
||||
if member.user.id == msg.from_user.id:
|
||||
left_chat = False
|
||||
if not left_chat:
|
||||
configSet(["reapply"], True, file=str(msg.from_user.id))
|
||||
configSet(["confirmed"], False, file=str(msg.from_user.id))
|
||||
await welcome_pass(app, msg, once_again=True)
|
||||
else:
|
||||
await msg.reply_text(locale("reapply_left_chat", "message"), reply_markup=InlineKeyboardMarkup([
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_old_one", "button"), f"reapply_old_{msg.id}")
|
||||
],
|
||||
[
|
||||
InlineKeyboardButton(locale("reapply_new_one", "button"), f"reapply_new_{msg.id}")
|
||||
]
|
||||
]))
|
||||
else:
|
||||
await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([
|
||||
[
|
||||
InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}")
|
||||
]
|
||||
])) # type: ignore
|
||||
else:
|
||||
if configGet("sent", file=str(msg.from_user.id)):
|
||||
await msg.reply_text(locale("reapply_forbidden", "message"))
|
||||
else:
|
||||
await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([
|
||||
[
|
||||
InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}")
|
||||
]
|
||||
])) # type: ignore
|
||||
# ==============================================================================================================================
|
Reference in New Issue
Block a user