Silenced some useless warnings

This commit is contained in:
Profitroll 2022-12-05 20:52:21 +01:00
parent 2185959363
commit 712b5d22ab
5 changed files with 17 additions and 17 deletions

2
app.py
View File

@ -6,7 +6,7 @@ app = Client("holochecker", bot_token=configGet("bot_token", "bot"), api_id=conf
async def isAnAdmin(admin_id): async def isAnAdmin(admin_id):
if admin_id == configGet("owner") or admin_id in configGet("admins"): if admin_id == configGet("owner") or admin_id in configGet("admins"):
return True return True
async for member in app.get_chat_members(configGet("admin_group")): async for member in app.get_chat_members(configGet("admin_group")): # type: ignore
if member.user.id == admin_id: if member.user.id == admin_id:
return True return True
return False return False

View File

@ -89,7 +89,7 @@ async def callback_query_reapply_old(app, clb):
configSet(["approved"], False, file=str(clb.from_user.id)) configSet(["approved"], False, file=str(clb.from_user.id))
configSet(["refused"], False, file=str(clb.from_user.id)) configSet(["refused"], False, file=str(clb.from_user.id))
await confirm_yes(app, message) await confirm_yes(app, message)
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]])) await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]])) # type: ignore
# Start a new application when user reapplies after leaving the chat # Start a new application when user reapplies after leaving the chat
@app.on_callback_query(filters.regex("reapply_new_[\s\S]*")) # type: ignore @app.on_callback_query(filters.regex("reapply_new_[\s\S]*")) # type: ignore
@ -106,7 +106,7 @@ async def callback_query_reapply_new(app, clb):
message = await app.get_messages(clb.from_user.id, int(fullclb[2])) message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
await welcome_pass(app, message, once_again=True) await welcome_pass(app, message, once_again=True)
logWrite(f"User {clb.from_user.id} restarted the application after leaving the chat earlier") logWrite(f"User {clb.from_user.id} restarted the application after leaving the chat earlier")
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]])) await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]])) # type: ignore
# Abort application fill in progress and restart it # Abort application fill in progress and restart it
@app.on_callback_query(filters.regex("reapply_stop_[\s\S]*")) # type: ignore @app.on_callback_query(filters.regex("reapply_stop_[\s\S]*")) # type: ignore

View File

@ -17,24 +17,24 @@ async def callback_query_rule(app, clb):
if rule_num == len(locale("rules")): if rule_num == len(locale("rules")):
lower_buttons = [ lower_buttons = [
InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}") InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}") # type: ignore
] ]
elif rule_num == 1: elif rule_num == 1:
lower_buttons = [ lower_buttons = [
InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}") InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}") # type: ignore
] ]
else: else:
lower_buttons = [ lower_buttons = [
InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}"), InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}"), # type: ignore
InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}") InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}") # type: ignore
] ]
try: try:
await clb.message.edit(text=locale("rules")[rule_num-1], disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup( await clb.message.edit(text=locale("rules")[rule_num-1], disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton(locale("rules_home", "button"), callback_data="rules_home"), InlineKeyboardButton(locale("rules_home", "button"), callback_data="rules_home"), # type: ignore
InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional") InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional") # type: ignore
], ],
lower_buttons lower_buttons
] ]

View File

@ -21,25 +21,25 @@ async def cmd_reapply(app, msg):
else: else:
await msg.reply_text(locale("reapply_left_chat", "message"), reply_markup=InlineKeyboardMarkup([ await msg.reply_text(locale("reapply_left_chat", "message"), reply_markup=InlineKeyboardMarkup([
[ [
InlineKeyboardButton(locale("reapply_old_one", "button"), f"reapply_old_{msg.id}") InlineKeyboardButton(locale("reapply_old_one", "button"), f"reapply_old_{msg.id}") # type: ignore
], ],
[ [
InlineKeyboardButton(locale("reapply_new_one", "button"), f"reapply_new_{msg.id}") InlineKeyboardButton(locale("reapply_new_one", "button"), f"reapply_new_{msg.id}") # type: ignore
] ]
])) ]))
else: else:
await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([ await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([ # type: ignore
[ [
InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}") InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}") # type: ignore
] ]
])) # type: ignore ])) # type: ignore
else: else:
if configGet("sent", file=str(msg.from_user.id)): if configGet("sent", file=str(msg.from_user.id)):
await msg.reply_text(locale("reapply_forbidden", "message")) await msg.reply_text(locale("reapply_forbidden", "message"))
else: else:
await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([ await msg.reply_text(locale("reapply_in_progress", "message").format(locale("confirm", "keyboard")[1][0]), reply_markup=InlineKeyboardMarkup([ # type: ignore
[ [
InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}") InlineKeyboardButton(locale("applying_stop", "button"), f"reapply_stop_{msg.id}") # type: ignore
] ]
])) # type: ignore ])) # type: ignore
# ============================================================================================================================== # ==============================================================================================================================

View File

@ -7,8 +7,8 @@ from modules.utils import locale
default_rules_markup = InlineKeyboardMarkup( default_rules_markup = InlineKeyboardMarkup(
[ [
[ [
InlineKeyboardButton(locale("rules_home", "button"), callback_data="rules_home"), InlineKeyboardButton(locale("rules_home", "button"), callback_data="rules_home"), # type: ignore
InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional") InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional") # type: ignore
], ],
[ [
InlineKeyboardButton("1", callback_data="rule_1"), InlineKeyboardButton("1", callback_data="rule_1"),