from app import app from pyrogram import filters from pyrogram.types import ForceReply, ReplyKeyboardMarkup, Message from pyrogram.client import Client from modules.utils import all_locales, locale, logWrite # Welcome check ================================================================================================================ welcome_1 = [] for pattern in all_locales("welcome", "keyboard"): welcome_1.append(pattern[0][0]) for pattern in all_locales("return", "keyboard"): welcome_1.append(pattern[0][0]) @app.on_message(~ filters.scheduled & filters.private & filters.command(welcome_1, prefixes=[""])) async def welcome_pass(app, msg, once_again: bool = True) -> None: """Set user's stage to 1 and start a fresh application ### Args: * app (app): Pyrogram Client to use * msg (Message): Message with .from_user.id attribute equal to the end-user ID whose application will be started * once_again (bool, optional): Set to False if it's the first time as user applies. Defaults to True. """ if not once_again: await msg.reply_text(locale("privacy_notice", "message")) logWrite(f"User {msg.from_user.id} confirmed starting the application") await msg.reply_text(locale("question1", "message", locale=msg.from_user), reply_markup=ForceReply(placeholder=locale("question1", "force_reply", locale=msg.from_user))) # configSet(["stage"], 1, file=str(msg.from_user.id)) # configSet(["sent"], False, file=str(msg.from_user.id)) welcome_2 = [] for pattern in all_locales("welcome", "keyboard"): welcome_2.append(pattern[1][0]) @app.on_message(~ filters.scheduled & filters.private & filters.command(welcome_2, prefixes=[""])) async def welcome_reject(app: Client, msg: Message): logWrite(f"User {msg.from_user.id} rejected to start the application") await msg.reply_text(locale("goodbye", "message", locale=msg.from_user), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboard", locale=msg.from_user), resize_keyboard=True)) # ==============================================================================================================================