Using application_restart() now

This commit is contained in:
Profitroll 2023-01-03 13:04:38 +01:00
parent 7854f88217
commit 6aa8128fc6

View File

@ -2,6 +2,7 @@ from app import app
from pyrogram import filters from pyrogram import filters
from pyrogram.types import ForceReply, ReplyKeyboardMarkup, Message from pyrogram.types import ForceReply, ReplyKeyboardMarkup, Message
from pyrogram.client import Client from pyrogram.client import Client
from classes.holo_user import HoloUser
from modules.utils import all_locales, locale, logWrite from modules.utils import all_locales, locale, logWrite
# Welcome check ================================================================================================================ # Welcome check ================================================================================================================
@ -11,7 +12,7 @@ for pattern in all_locales("welcome", "keyboard"):
for pattern in all_locales("return", "keyboard"): for pattern in all_locales("return", "keyboard"):
welcome_1.append(pattern[0][0]) welcome_1.append(pattern[0][0])
@app.on_message(~ filters.scheduled & filters.private & filters.command(welcome_1, prefixes=[""])) @app.on_message(~ filters.scheduled & filters.private & filters.command(welcome_1, prefixes=[""]))
async def welcome_pass(app, msg, once_again: bool = True) -> None: async def welcome_pass(app: Client, msg: Message, once_again: bool = True) -> None:
"""Set user's stage to 1 and start a fresh application """Set user's stage to 1 and start a fresh application
### Args: ### Args:
@ -23,6 +24,10 @@ async def welcome_pass(app, msg, once_again: bool = True) -> None:
if not once_again: if not once_again:
await msg.reply_text(locale("privacy_notice", "message")) await msg.reply_text(locale("privacy_notice", "message"))
holo_user = HoloUser(msg.from_user)
holo_user.application_restart()
logWrite(f"User {msg.from_user.id} confirmed starting the application") 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))) 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(["stage"], 1, file=str(msg.from_user.id))