2022-12-05 19:49:51 +02:00
|
|
|
from app import app
|
|
|
|
from pyrogram import filters
|
2022-12-06 11:26:22 +02:00
|
|
|
from pyrogram.types import ForceReply, ReplyKeyboardMarkup
|
2022-12-12 00:32:35 +02:00
|
|
|
from classes.holo_user import HoloUser
|
2022-12-05 19:49:51 +02:00
|
|
|
from modules.utils import configGet, configSet, locale, logWrite
|
|
|
|
|
|
|
|
# Welcome check ================================================================================================================
|
|
|
|
@app.on_message(~ filters.scheduled & filters.private & (filters.regex(locale("welcome", "keyboard")[0][0]) | filters.regex(locale("return", "keyboard")[0][0])))
|
|
|
|
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.
|
|
|
|
"""
|
|
|
|
|
2022-12-12 00:32:35 +02:00
|
|
|
holo_user = HoloUser(msg.from_user)
|
|
|
|
|
2022-12-05 19:49:51 +02:00
|
|
|
if not once_again:
|
|
|
|
await msg.reply_text(locale("privacy_notice", "message"))
|
|
|
|
|
|
|
|
logWrite(f"User {msg.from_user.id} confirmed starting the application")
|
2022-12-06 11:26:22 +02:00
|
|
|
await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply")))
|
2022-12-14 14:58:06 +02:00
|
|
|
# configSet(["stage"], 1, file=str(msg.from_user.id))
|
|
|
|
# configSet(["sent"], False, file=str(msg.from_user.id))
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
@app.on_message(~ filters.scheduled & filters.private & (filters.regex(locale("welcome", "keyboard")[1][0])))
|
|
|
|
async def welcome_reject(app, msg):
|
|
|
|
|
2022-12-15 14:50:11 +02:00
|
|
|
logWrite(f"User {msg.from_user.id} rejected to start the application")
|
2022-12-06 11:26:22 +02:00
|
|
|
await msg.reply_text(locale("goodbye", "message"), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboard"), resize_keyboard=True))
|
2022-12-05 19:49:51 +02:00
|
|
|
# ==============================================================================================================================
|