Users now need to confirm that stuff is correct
This commit is contained in:
parent
7d0c05bf40
commit
bb6b0b056c
@ -2,6 +2,7 @@
|
||||
"stage": 0,
|
||||
"link": null,
|
||||
"sent": false,
|
||||
"confirmed": false,
|
||||
"approved": false,
|
||||
"approved_by": null,
|
||||
"application_date": null,
|
||||
|
@ -24,6 +24,7 @@
|
||||
"question2_underage": "Вибач, але треба досягти віку {0} років, щоб приєднатись до нас. Такі обмеження існують для того, щоб всім у спільноті було цікаво одне з одним.",
|
||||
"question2_invalid": "Будь ласка, введи ціле число.",
|
||||
"question2_joke": "Тижпрограміст, ми так і поняли. Але будь ласка, введи реальне значення.",
|
||||
"confirm": "Супер, дякуємо!\n\nБудь ласка, перевір правильність даних:\n{0}\n\nВсе правильно?",
|
||||
"shutdown": "Вимкнення бота з підом `{0}`",
|
||||
"startup": "Запуск бота з підом `{0}`",
|
||||
"startup_downtime": "Запуск бота з підом `{0}` (лежав {1})",
|
||||
@ -43,6 +44,14 @@
|
||||
[
|
||||
"Я передумав, я хочу"
|
||||
]
|
||||
],
|
||||
"confirm": [
|
||||
[
|
||||
"Так, все правильно"
|
||||
],
|
||||
[
|
||||
"Ні, повторно заповнити"
|
||||
]
|
||||
]
|
||||
},
|
||||
"force_reply": {
|
||||
|
40
main.py
40
main.py
@ -1,11 +1,11 @@
|
||||
import asyncio
|
||||
from time import time
|
||||
from os import getpid, listdir
|
||||
from os import getpid, listdir, remove
|
||||
from modules.utils import *
|
||||
|
||||
from pyrogram.client import Client
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, BotCommand, BotCommandScopeChat, ReplyKeyboardMarkup, ForceReply
|
||||
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, BotCommand, BotCommandScopeChat, ReplyKeyboardMarkup, ForceReply, ReplyKeyboardRemove
|
||||
from pyrogram import idle # type: ignore
|
||||
from pyrogram.errors.exceptions import bad_request_400
|
||||
|
||||
@ -39,9 +39,11 @@ async def cmd_kill(app, msg):
|
||||
killProc(pid)
|
||||
|
||||
@app.on_message(~ filters.scheduled & (filters.regex(locale("welcome", "keyboards")[0][0]) | filters.regex(locale("return", "keyboards")[0][0])))
|
||||
async def welcome_pass(app, msg):
|
||||
async def welcome_pass(app, msg, once_again: bool = True):
|
||||
|
||||
if not once_again:
|
||||
await msg.reply_text(locale("privacy_notice", "message"))
|
||||
|
||||
await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply")))
|
||||
configSet("stage", 1, file=str(msg.from_user.id))
|
||||
|
||||
@ -50,6 +52,29 @@ async def welcome_reject(app, msg):
|
||||
|
||||
await msg.reply_text(locale("goodbye", "message"), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboards"), resize_keyboard=True))
|
||||
|
||||
@app.on_message(~ filters.scheduled & (filters.regex(locale("confirm", "keyboards")[0][0])))
|
||||
async def confirm_yes(app, msg):
|
||||
|
||||
user_stage = configGet("stage", file=str(msg.from_user.id))
|
||||
|
||||
if user_stage == 10:
|
||||
await msg.reply_text("Alright! You did it!", reply_markup=ReplyKeyboardRemove())
|
||||
# send to admins
|
||||
configSet("sent", True, file=str(msg.from_user.id))
|
||||
configSet("application_date", int(time()), file=str(msg.from_user.id))
|
||||
|
||||
@app.on_message(~ filters.scheduled & (filters.regex(locale("confirm", "keyboards")[1][0])))
|
||||
async def confirm_no(app, msg):
|
||||
|
||||
user_stage = configGet("stage", file=str(msg.from_user.id))
|
||||
|
||||
if user_stage == 10:
|
||||
jsonSave(jsonLoad(f"data{sep}user_default.json"), f"data{sep}users{sep}{msg.from_user.id}.json")
|
||||
configSet("telegram_id", str(msg.from_user.username), file=str(msg.from_user.id))
|
||||
configSet("telegram_name", f"{msg.from_user.first_name} {msg.from_user.last_name}", file=str(msg.from_user.id))
|
||||
configSet("telegram_phone", str(msg.from_user.phone_number), file=str(msg.from_user.id))
|
||||
configSet("telegram_locale", str(msg.from_user.language_code), file=str(msg.from_user.id))
|
||||
await welcome_pass(app, msg, once_again=True)
|
||||
|
||||
@app.on_message(~ filters.scheduled)
|
||||
async def any_stage(app, msg):
|
||||
@ -74,10 +99,13 @@ async def any_stage(app, msg):
|
||||
configSet("stage", user_stage+1, file=str(msg.from_user.id))
|
||||
else:
|
||||
if not configGet("sent", file=str(msg.from_user.id)):
|
||||
await msg.reply_text("You are fucking done, great job!")
|
||||
if not configGet("confirmed", file=str(msg.from_user.id)):
|
||||
await msg.reply_text(locale("confirm", "message"), reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboards"), resize_keyboard=True))
|
||||
configSet(str(user_stage), str(msg.text), "application", file=str(msg.from_user.id))
|
||||
configSet("sent", True, file=str(msg.from_user.id))
|
||||
configSet("application_date", int(time()), file=str(msg.from_user.id))
|
||||
#configSet("sent", True, file=str(msg.from_user.id))
|
||||
#configSet("application_date", int(time()), file=str(msg.from_user.id))
|
||||
else:
|
||||
await msg.reply_text("You are already done, wait!")
|
||||
else:
|
||||
await msg.reply_text("You are already done, wait!")
|
||||
|
||||
|
Reference in New Issue
Block a user