2022-12-05 19:49:51 +02:00
|
|
|
from app import app
|
|
|
|
from pyrogram import filters
|
2022-12-27 14:36:54 +02:00
|
|
|
from pyrogram.types import ForceReply, ReplyKeyboardMarkup, Message
|
|
|
|
from pyrogram.client import Client
|
2023-01-03 14:04:38 +02:00
|
|
|
from classes.holo_user import HoloUser
|
2022-12-17 01:58:33 +02:00
|
|
|
from modules.utils import all_locales, locale, logWrite
|
2023-01-03 21:34:13 +02:00
|
|
|
from modules import custom_filters
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
# Welcome check ================================================================================================================
|
2022-12-17 01:58:33 +02:00
|
|
|
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])
|
2023-03-09 17:25:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
@app.on_message(
|
|
|
|
custom_filters.enabled_applications
|
|
|
|
& ~filters.scheduled
|
|
|
|
& filters.private
|
|
|
|
& filters.command(welcome_1, prefixes=[""])
|
|
|
|
& ~custom_filters.banned
|
|
|
|
)
|
2023-01-11 13:28:58 +02:00
|
|
|
async def welcome_pass(app: Client, msg: Message, once_again: bool = False) -> None:
|
2022-12-05 19:49:51 +02:00
|
|
|
"""Set user's stage to 1 and start a fresh application
|
|
|
|
|
|
|
|
### Args:
|
2023-03-09 17:25:06 +02:00
|
|
|
* app (app): Pyrogram Client to use
|
2022-12-05 19:49:51 +02:00
|
|
|
* 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.
|
2023-03-09 17:25:06 +02:00
|
|
|
"""
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
if not once_again:
|
|
|
|
await msg.reply_text(locale("privacy_notice", "message"))
|
2023-01-03 14:04:38 +02:00
|
|
|
|
|
|
|
holo_user = HoloUser(msg.from_user)
|
|
|
|
|
2023-01-11 13:28:58 +02:00
|
|
|
if once_again is False:
|
|
|
|
holo_user.application_restart()
|
2023-03-09 17:25:06 +02:00
|
|
|
|
2023-01-16 13:10:07 +02:00
|
|
|
if once_again is True:
|
|
|
|
logWrite(f"User {msg.from_user.id} confirmed starting the application")
|
|
|
|
else:
|
2023-03-09 17:25:06 +02:00
|
|
|
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)
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
2022-12-05 19:49:51 +02:00
|
|
|
|
2022-12-17 01:58:33 +02:00
|
|
|
welcome_2 = []
|
|
|
|
for pattern in all_locales("welcome", "keyboard"):
|
|
|
|
welcome_2.append(pattern[1][0])
|
2022-12-05 19:49:51 +02:00
|
|
|
|
2023-03-09 17:25:06 +02:00
|
|
|
|
|
|
|
@app.on_message(
|
|
|
|
custom_filters.enabled_applications
|
|
|
|
& ~filters.scheduled
|
|
|
|
& filters.private
|
|
|
|
& filters.command(welcome_2, prefixes=[""])
|
|
|
|
& ~custom_filters.banned
|
|
|
|
)
|
|
|
|
async def welcome_reject(app: Client, msg: Message):
|
2022-12-15 14:50:11 +02:00
|
|
|
logWrite(f"User {msg.from_user.id} rejected to start the application")
|
2023-03-09 17:25:06 +02:00
|
|
|
await msg.reply_text(
|
|
|
|
locale("goodbye", "message", locale=msg.from_user),
|
|
|
|
reply_markup=ReplyKeyboardMarkup(
|
|
|
|
locale("return", "keyboard", locale=msg.from_user), resize_keyboard=True
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# ==============================================================================================================================
|