Removed # type: ignore and fixed missing imports
This commit is contained in:
@@ -5,6 +5,7 @@ from datetime import datetime
|
||||
from app import app
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import ReplyKeyboardRemove, InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from pyrogram.enums.parse_mode import ParseMode
|
||||
from modules.utils import configGet, configSet, jsonLoad, jsonSave, locale, logWrite
|
||||
from modules.handlers.welcome import welcome_pass
|
||||
|
||||
@@ -47,7 +48,7 @@ async def confirm_yes(app, msg):
|
||||
i += 1
|
||||
|
||||
if configGet("reapply", file=str(msg.from_user.id)):
|
||||
await app.send_message(chat_id=configGet("admin_group"), text=(locale("reapply_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
|
||||
await app.send_message(chat_id=configGet("admin_group"), text=(locale("reapply_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(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(text=str(locale("reapply_yes", "button")), callback_data=f"reapply_yes_{msg.from_user.id}")
|
||||
@@ -59,7 +60,7 @@ async def confirm_yes(app, msg):
|
||||
)
|
||||
)
|
||||
else:
|
||||
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
|
||||
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(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(text=str(locale("sub_yes", "button")), callback_data=f"sub_yes_{msg.from_user.id}")
|
||||
|
@@ -24,20 +24,20 @@ async def get_contact(app, msg):
|
||||
i += 1
|
||||
if user_data["sent"]:
|
||||
if user_data["approved"]:
|
||||
application_status = locale("application_status_accepted", "message").format((await app.get_users(application["approved_by"])).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||
application_status = locale("application_status_accepted", "message").format((await app.get_users(application["approved_by"])).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
elif application["refused"]:
|
||||
application_status = locale("application_status_refused", "message").format((await app.get_users(application["refused_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||
application_status = locale("application_status_refused", "message").format((await app.get_users(application["refused_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
else:
|
||||
application_status = locale("application_status_on_hold", "message")
|
||||
else:
|
||||
if user_data["approved"]:
|
||||
application_status = locale("application_status_accepted", "message").format((await app.get_users(application["approved_by"])).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||
application_status = locale("application_status_accepted", "message").format((await app.get_users(application["approved_by"])).first_name, datetime.fromtimestamp(application["approval_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
elif application["refused"]:
|
||||
application_status = locale("application_status_refused", "message").format((await app.get_users(application["refused_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M")) # type: ignore
|
||||
application_status = locale("application_status_refused", "message").format((await app.get_users(application["refused_by"])).first_name, datetime.fromtimestamp(application["refusal_date"]).strftime("%d.%m.%Y, %H:%M"))
|
||||
else:
|
||||
application_status = locale("application_status_not_send", "message")
|
||||
logWrite(f"User {msg.from_user.id} requested application of {msg.contact.user_id}")
|
||||
await msg.reply_text(locale("contact", "message").format(str(msg.contact.user_id), "\n".join(application_content), application_status)) # type: ignore
|
||||
await msg.reply_text(locale("contact", "message").format(str(msg.contact.user_id), "\n".join(application_content), application_status))
|
||||
except FileNotFoundError:
|
||||
logWrite(f"User {msg.from_user.id} requested application of {msg.contact.user_id} but user does not exists")
|
||||
await msg.reply_text(locale("contact_invalid", "message"))
|
||||
|
@@ -2,7 +2,7 @@ from datetime import datetime
|
||||
from app import app
|
||||
import asyncio
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import ForceReply
|
||||
from pyrogram.types import ForceReply, ReplyKeyboardMarkup
|
||||
from modules.utils import configGet, configSet, locale, logWrite
|
||||
|
||||
# Any other input ==============================================================================================================
|
||||
@@ -33,7 +33,7 @@ async def any_stage(app, msg):
|
||||
|
||||
elif ((datetime.now() - input_dt).days) < ((datetime.now() - datetime.now().replace(year=datetime.now().year - configGet("age_allowed"))).days):
|
||||
logWrite(f"User {msg.from_user.id} failed stage {user_stage} due to being underage")
|
||||
await msg.reply_text(locale("question2_underage", "message").format(str(configGet("age_allowed"))), reply_markup=ForceReply(placeholder=str(locale("question2", "force_reply")))) # type: ignore
|
||||
await msg.reply_text(locale("question2_underage", "message").format(str(configGet("age_allowed"))), reply_markup=ForceReply(placeholder=str(locale("question2", "force_reply"))))
|
||||
|
||||
else:
|
||||
logWrite(f"User {msg.from_user.id} completed stage {user_stage} of application")
|
||||
@@ -59,7 +59,7 @@ async def any_stage(app, msg):
|
||||
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 msg.reply_text(locale("confirm", "message").format("\n".join(application_content)), reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboard"), resize_keyboard=True)) # type: ignore
|
||||
await msg.reply_text(locale("confirm", "message").format("\n".join(application_content)), reply_markup=ReplyKeyboardMarkup(locale("confirm", "keyboard"), resize_keyboard=True))
|
||||
#configSet("sent", True, file=str(msg.from_user.id))
|
||||
#configSet("application_date", int(time()), file=str(msg.from_user.id))
|
||||
else:
|
||||
|
@@ -1,5 +1,6 @@
|
||||
from app import app
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import ForceReply, ReplyKeyboardMarkup
|
||||
from modules.utils import configGet, configSet, locale, logWrite
|
||||
|
||||
# Welcome check ================================================================================================================
|
||||
@@ -17,7 +18,7 @@ async def welcome_pass(app, msg, once_again: bool = True) -> None:
|
||||
await msg.reply_text(locale("privacy_notice", "message"))
|
||||
|
||||
logWrite(f"User {msg.from_user.id} confirmed starting the application")
|
||||
await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply"))) # type: ignore
|
||||
await msg.reply_text(locale("question1", "message"), reply_markup=ForceReply(placeholder=locale("question1", "force_reply")))
|
||||
configSet(["stage"], 1, file=str(msg.from_user.id))
|
||||
configSet(["sent"], False, file=str(msg.from_user.id))
|
||||
|
||||
@@ -25,5 +26,5 @@ async def welcome_pass(app, msg, once_again: bool = True) -> None:
|
||||
async def welcome_reject(app, msg):
|
||||
|
||||
logWrite(f"User {msg.from_user.id} refused to start the application")
|
||||
await msg.reply_text(locale("goodbye", "message"), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboard"), resize_keyboard=True)) # type: ignore
|
||||
await msg.reply_text(locale("goodbye", "message"), reply_markup=ReplyKeyboardMarkup(locale("return", "keyboard"), resize_keyboard=True))
|
||||
# ==============================================================================================================================
|
Reference in New Issue
Block a user