Added one more check
This commit is contained in:
parent
12c0664c0a
commit
1e97c75b5e
72
main.py
72
main.py
@ -74,52 +74,54 @@ async def confirm_yes(app, msg):
|
|||||||
|
|
||||||
if user_stage == 10:
|
if user_stage == 10:
|
||||||
|
|
||||||
await msg.reply_text(locale("application_sent", "message"), reply_markup=ReplyKeyboardRemove())
|
if not configGet("sent", file=str(msg.from_user.id)):
|
||||||
|
|
||||||
applications = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")
|
await msg.reply_text(locale("application_sent", "message"), reply_markup=ReplyKeyboardRemove())
|
||||||
|
|
||||||
applications[str(msg.from_user.id)] = {
|
applications = jsonLoad(f"{configGet('data', 'locations')}{sep}applications.json")
|
||||||
"approved": False,
|
|
||||||
"approved_by": None,
|
|
||||||
"approval_date": None,
|
|
||||||
"refused": False,
|
|
||||||
"refused_by": False,
|
|
||||||
"refusal_date": False,
|
|
||||||
"application_date": int(time()),
|
|
||||||
"application": configGet("application", file=str(msg.from_user.id))
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonSave(applications, f"{configGet('data', 'locations')}{sep}applications.json")
|
applications[str(msg.from_user.id)] = {
|
||||||
|
"approved": False,
|
||||||
|
"approved_by": None,
|
||||||
|
"approval_date": None,
|
||||||
|
"refused": False,
|
||||||
|
"refused_by": False,
|
||||||
|
"refusal_date": False,
|
||||||
|
"application_date": int(time()),
|
||||||
|
"application": configGet("application", file=str(msg.from_user.id))
|
||||||
|
}
|
||||||
|
|
||||||
application_content = []
|
jsonSave(applications, f"{configGet('data', 'locations')}{sep}applications.json")
|
||||||
i = 1
|
|
||||||
|
|
||||||
for question in configGet("application", file=str(msg.from_user.id)):
|
application_content = []
|
||||||
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {configGet('application', file=str(msg.from_user.id))[question]}")
|
i = 1
|
||||||
i += 1
|
|
||||||
|
|
||||||
await app.send_message(chat_id=configGet("admin_group"), text=(locale("application_got", "message")).format(str(msg.from_user.id), msg.from_user.first_name, msg.from_user.last_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( # type: ignore
|
for question in configGet("application", file=str(msg.from_user.id)):
|
||||||
[
|
application_content.append(f"{locale('question'+str(i), 'message', 'question_titles')} {configGet('application', file=str(msg.from_user.id))[question]}")
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
await app.send_message(chat_id=configGet("admin_group"), text=(locale("application_got", "message")).format(str(msg.from_user.id), msg.from_user.first_name, msg.from_user.last_name, msg.from_user.username, "\n".join(application_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup( # type: ignore
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(text=str(locale("sub_yes", "button")), callback_data=f"sub_yes_{msg.from_user.id}")
|
[
|
||||||
],
|
InlineKeyboardButton(text=str(locale("sub_yes", "button")), callback_data=f"sub_yes_{msg.from_user.id}")
|
||||||
[
|
],
|
||||||
InlineKeyboardButton(text=str(locale("sub_no", "button")), callback_data=f"sub_no_{msg.from_user.id}")
|
[
|
||||||
],
|
InlineKeyboardButton(text=str(locale("sub_no", "button")), callback_data=f"sub_no_{msg.from_user.id}")
|
||||||
[
|
],
|
||||||
InlineKeyboardButton(text=str(locale("sub_no_aggressive", "button")), callback_data=f"sub_no_aggresive_{msg.from_user.id}")
|
[
|
||||||
],
|
InlineKeyboardButton(text=str(locale("sub_no_aggressive", "button")), callback_data=f"sub_no_aggresive_{msg.from_user.id}")
|
||||||
[
|
],
|
||||||
InlineKeyboardButton(text=str(locale("sub_no_russian", "button")), callback_data=f"sub_no_russian_{msg.from_user.id}")
|
[
|
||||||
|
InlineKeyboardButton(text=str(locale("sub_no_russian", "button")), callback_data=f"sub_no_russian_{msg.from_user.id}")
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
logWrite(f"User {msg.from_user.id} sent his application and it will now be reviewed")
|
logWrite(f"User {msg.from_user.id} sent his application and it will now be reviewed")
|
||||||
|
|
||||||
configSet("sent", True, file=str(msg.from_user.id))
|
configSet("sent", True, file=str(msg.from_user.id))
|
||||||
configSet("confirmed", True, file=str(msg.from_user.id))
|
configSet("confirmed", True, file=str(msg.from_user.id))
|
||||||
|
|
||||||
@app.on_message(~ filters.scheduled & filters.private & (filters.regex(locale("confirm", "keyboard")[1][0])))
|
@app.on_message(~ filters.scheduled & filters.private & (filters.regex(locale("confirm", "keyboard")[1][0])))
|
||||||
async def confirm_no(app, msg):
|
async def confirm_no(app, msg):
|
||||||
|
Reference in New Issue
Block a user