small improvements

This commit is contained in:
Profitroll 2022-10-20 14:43:13 +02:00
parent e2f98c8ee6
commit eb0712f793

16
main.py
View File

@ -16,14 +16,14 @@ app = Client("holochecker", bot_token=configGet("bot_token", "bot"), api_id=conf
async def cmd_start(app, msg): async def cmd_start(app, msg):
try: try:
user_conf = configGet("stage", file=str(msg.from_user.id)) user_stage = configGet("stage", file=str(msg.from_user.id))
if user_conf["stage"] != 0: if user_stage != 0:
return return
except FileNotFoundError: except FileNotFoundError:
jsonSave(jsonLoad(f"data{sep}user_default.json"), f"data{sep}users{sep}{msg.from_user.id}.json") jsonSave(jsonLoad(f"data{sep}user_default.json"), f"data{sep}users{sep}{msg.from_user.id}.json")
user_conf = configGet("stage", file=str(msg.from_user.id)) user_stage = configGet("stage", file=str(msg.from_user.id))
await msg.reply_text(locale("start"), reply_markup=ReplyKeyboardMarkup(locale("welcome", "keyboards"))) await msg.reply_text(locale("start", "message"), reply_markup=ReplyKeyboardMarkup(locale("welcome", "keyboards")))
@app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"])) @app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"]))
async def cmd_kill(app, msg): async def cmd_kill(app, msg):
@ -34,10 +34,16 @@ async def cmd_kill(app, msg):
killProc(pid) killProc(pid)
@app.on_message(~ filters.scheduled & (filters.regex(locale("welcome", "keyboards")[0][0]) | filters.regex(locale("return", "keyboards")[0][0]))) @app.on_message(~ filters.scheduled & (filters.regex(locale("welcome", "keyboards")[0][0]) | filters.regex(locale("return", "keyboards")[0][0])))
async def any_message(app, msg): async def welcome_pass(app, msg):
await msg.reply_text(locale("privacy_notice", "message")) await msg.reply_text(locale("privacy_notice", "message"))
await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply"))) await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply")))
configSet("stage", 1, file=str(msg.from_user.id))
@app.on_message(~ filters.scheduled & (filters.regex(locale("welcome", "keyboards")[1][0])))
async def welcome_reject(app, msg):
await msg.reply_text(locale("goodbye", "message"), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboards")))
if __name__ == "__main__": if __name__ == "__main__":