Removed # type: ignore and fixed missing imports
This commit is contained in:
@@ -3,7 +3,7 @@ from pyrogram import filters
|
||||
from modules.utils import locale
|
||||
|
||||
# Callback empty ===============================================================================================================
|
||||
@app.on_callback_query(filters.regex("nothing")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("nothing"))
|
||||
async def callback_query_nothing(app, clb):
|
||||
await clb.answer(text=locale("nothing", "callback"))
|
||||
# ==============================================================================================================================
|
@@ -8,12 +8,12 @@ from modules.handlers.confirmation import confirm_yes
|
||||
from modules.handlers.welcome import welcome_pass
|
||||
|
||||
# Callbacks reapply ============================================================================================================
|
||||
@app.on_callback_query(filters.regex("reapply_yes_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("reapply_yes_[\s\S]*"))
|
||||
async def callback_reapply_query_accept(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
logWrite(f"User {fullclb[2]} got their reapplication approved by {clb.from_user.id}")
|
||||
|
||||
await app.send_message(int(fullclb[2]), locale("approved_joined", "message"))
|
||||
@@ -30,7 +30,7 @@ async def callback_reapply_query_accept(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_accepted", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_accepted", "callback").format(fullclb[2]), show_alert=True)
|
||||
|
||||
need_link = True
|
||||
|
||||
@@ -58,12 +58,12 @@ async def callback_reapply_query_accept(app, clb):
|
||||
else:
|
||||
await app.send_message(int(fullclb[2]), locale("approved_joined", "message"))
|
||||
|
||||
@app.on_callback_query(filters.regex("reapply_no_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("reapply_no_[\s\S]*"))
|
||||
async def callback_query_reapply_refuse(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
await app.send_message(int(fullclb[2]), locale("refused", "message"))
|
||||
logWrite(f"User {fullclb[2]} got their reapplication refused by {clb.from_user.id}")
|
||||
|
||||
@@ -79,20 +79,20 @@ async def callback_query_reapply_refuse(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("declined", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_refused", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_refused", "callback").format(fullclb[2]), show_alert=True)
|
||||
|
||||
# Use old application when user reapplies after leaving the chat
|
||||
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("reapply_old_[\s\S]*"))
|
||||
async def callback_query_reapply_old(app, clb):
|
||||
fullclb = clb.data.split("_")
|
||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||
configSet(["approved"], False, file=str(clb.from_user.id))
|
||||
configSet(["refused"], False, file=str(clb.from_user.id))
|
||||
await confirm_yes(app, message)
|
||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]])) # type: ignore
|
||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]]))
|
||||
|
||||
# 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]*"))
|
||||
async def callback_query_reapply_new(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
@@ -106,10 +106,10 @@ async def callback_query_reapply_new(app, clb):
|
||||
message = await app.get_messages(clb.from_user.id, int(fullclb[2]))
|
||||
await welcome_pass(app, message, once_again=True)
|
||||
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")]])) # type: ignore
|
||||
await clb.message.edit(clb.message.text, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("done", "button"), "nothing")]]))
|
||||
|
||||
# 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]*"))
|
||||
async def callback_query_reapply_stop(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
@@ -6,7 +6,7 @@ from modules.utils import locale, logWrite
|
||||
from modules.commands.rules import default_rules_markup
|
||||
|
||||
# Callback rule ================================================================================================================
|
||||
@app.on_callback_query(filters.regex("rule_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("rule_[\s\S]*"))
|
||||
async def callback_query_rule(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
@@ -17,24 +17,24 @@ async def callback_query_rule(app, clb):
|
||||
|
||||
if rule_num == len(locale("rules")):
|
||||
lower_buttons = [
|
||||
InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}") # type: ignore
|
||||
InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}")
|
||||
]
|
||||
elif rule_num == 1:
|
||||
lower_buttons = [
|
||||
InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}") # type: ignore
|
||||
InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}")
|
||||
]
|
||||
else:
|
||||
lower_buttons = [
|
||||
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}") # type: ignore
|
||||
InlineKeyboardButton(locale("rules_prev", "button"), callback_data=f"rule_{rule_num-1}"),
|
||||
InlineKeyboardButton(locale("rules_next", "button"), callback_data=f"rule_{rule_num+1}")
|
||||
]
|
||||
|
||||
try:
|
||||
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"), # type: ignore
|
||||
InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional") # type: ignore
|
||||
InlineKeyboardButton(locale("rules_home", "button"), callback_data="rules_home"),
|
||||
InlineKeyboardButton(locale("rules_additional", "button"), callback_data="rules_additional")
|
||||
],
|
||||
lower_buttons
|
||||
]
|
||||
@@ -43,9 +43,9 @@ async def callback_query_rule(app, clb):
|
||||
except bad_request_400.MessageNotModified:
|
||||
pass
|
||||
|
||||
await clb.answer(text=locale("rules_page", "callback").format(fullclb[1])) # type: ignore
|
||||
await clb.answer(text=locale("rules_page", "callback").format(fullclb[1]))
|
||||
|
||||
@app.on_callback_query(filters.regex("rules_home")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("rules_home"))
|
||||
async def callback_query_rules_home(app, clb):
|
||||
|
||||
logWrite(f"User {clb.from_user.id} requested to check out homepage rules")
|
||||
@@ -55,9 +55,9 @@ async def callback_query_rules_home(app, clb):
|
||||
except bad_request_400.MessageNotModified:
|
||||
pass
|
||||
|
||||
await clb.answer(text=locale("rules_home", "callback")) # type: ignore
|
||||
await clb.answer(text=locale("rules_home", "callback"))
|
||||
|
||||
@app.on_callback_query(filters.regex("rules_additional")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("rules_additional"))
|
||||
async def callback_query_rules_additional(app, clb):
|
||||
|
||||
logWrite(f"User {clb.from_user.id} requested to check out additional rules")
|
||||
@@ -67,5 +67,5 @@ async def callback_query_rules_additional(app, clb):
|
||||
except bad_request_400.MessageNotModified:
|
||||
pass
|
||||
|
||||
await clb.answer(text=locale("rules_additional", "callback")) # type: ignore
|
||||
await clb.answer(text=locale("rules_additional", "callback"))
|
||||
# ==============================================================================================================================
|
@@ -6,12 +6,12 @@ from pyrogram import filters
|
||||
from modules.utils import configGet, configSet, jsonLoad, jsonSave, locale, logWrite
|
||||
|
||||
# Callbacks application ========================================================================================================
|
||||
@app.on_callback_query(filters.regex("sub_yes_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sub_yes_[\s\S]*"))
|
||||
async def callback_query_accept(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("approved_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
logWrite(f"User {fullclb[2]} got approved by {clb.from_user.id}")
|
||||
|
||||
need_link = True
|
||||
@@ -52,14 +52,14 @@ async def callback_query_accept(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_accepted", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_accepted", "callback").format(fullclb[2]), show_alert=True)
|
||||
|
||||
@app.on_callback_query(filters.regex("sub_no_aggressive_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sub_no_aggressive_[\s\S]*"))
|
||||
async def callback_query_refuse_aggressive(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by_agr", "message").format(clb.from_user.first_name, fullclb[3]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by_agr", "message").format(clb.from_user.first_name, fullclb[3]), disable_notification=True)
|
||||
await app.send_message(int(fullclb[3]), locale("refused", "message"))
|
||||
logWrite(f"User {fullclb[3]} got refused by {clb.from_user.id} due to being aggressive")
|
||||
|
||||
@@ -75,14 +75,14 @@ async def callback_query_refuse_aggressive(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("declined", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_no_aggressive", "callback").format(fullclb[3]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_no_aggressive", "callback").format(fullclb[3]), show_alert=True)
|
||||
|
||||
@app.on_callback_query(filters.regex("sub_no_russian_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sub_no_russian_[\s\S]*"))
|
||||
async def callback_query_refuse_russian(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by_rus", "message").format(clb.from_user.first_name, fullclb[3]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by_rus", "message").format(clb.from_user.first_name, fullclb[3]), disable_notification=True)
|
||||
await app.send_message(int(fullclb[3]), locale("refused", "message"))
|
||||
await app.send_message(int(fullclb[3]), locale("refused_russian", "message"))
|
||||
logWrite(f"User {fullclb[3]} got refused by {clb.from_user.id} due to being russian")
|
||||
@@ -99,14 +99,14 @@ async def callback_query_refuse_russian(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("declined", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_no_russian", "callback").format(fullclb[3]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_no_russian", "callback").format(fullclb[3]), show_alert=True)
|
||||
|
||||
@app.on_callback_query(filters.regex("sub_no_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sub_no_[\s\S]*"))
|
||||
async def callback_query_refuse(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
await app.send_message(int(fullclb[2]), locale("refused", "message"))
|
||||
logWrite(f"User {fullclb[2]} got refused by {clb.from_user.id}")
|
||||
|
||||
@@ -122,5 +122,5 @@ async def callback_query_refuse(app, clb):
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("declined", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sub_refused", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sub_refused", "callback").format(fullclb[2]), show_alert=True)
|
||||
# ==============================================================================================================================
|
@@ -5,18 +5,18 @@ from pyrogram import filters
|
||||
from modules.utils import configGet, configSet, jsonLoad, jsonSave, locale, logWrite
|
||||
|
||||
# Callbacks sus users ==========================================================================================================
|
||||
@app.on_callback_query(filters.regex("sus_allow_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sus_allow_[\s\S]*"))
|
||||
async def callback_query_sus_allow(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("sus_allowed_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("sus_allowed_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
logWrite(f"User {fullclb[2]} was allowed to join with another link by {clb.from_user.id}")
|
||||
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("sus_allowed", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sus_allowed", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sus_allowed", "callback").format(fullclb[2]), show_alert=True)
|
||||
|
||||
await app.restrict_chat_member(configGet("destination_group"), int(fullclb[2]), permissions=ChatPermissions(
|
||||
can_send_messages=True,
|
||||
@@ -26,18 +26,18 @@ async def callback_query_sus_allow(app, clb):
|
||||
)
|
||||
)
|
||||
|
||||
@app.on_callback_query(filters.regex("sus_refuse_[\s\S]*")) # type: ignore
|
||||
@app.on_callback_query(filters.regex("sus_refuse_[\s\S]*"))
|
||||
async def callback_query_sus_refuse(app, clb):
|
||||
|
||||
fullclb = clb.data.split("_")
|
||||
|
||||
await app.send_message(configGet("admin_group"), locale("sus_refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True) # type: ignore
|
||||
await app.send_message(configGet("admin_group"), locale("sus_refused_by", "message").format(clb.from_user.first_name, fullclb[2]), disable_notification=True)
|
||||
logWrite(f"User {fullclb[2]} was refused to join with another link by {clb.from_user.id}")
|
||||
|
||||
edited_markup = [[InlineKeyboardButton(text=str(locale("sus_refused", "button")), callback_data="nothing")]]
|
||||
|
||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||
await clb.answer(text=locale("sus_refused", "callback").format(fullclb[2]), show_alert=True) # type: ignore
|
||||
await clb.answer(text=locale("sus_refused", "callback").format(fullclb[2]), show_alert=True)
|
||||
|
||||
await app.ban_chat_member(configGet("destination_group"), int(fullclb[2]))
|
||||
|
||||
|
Reference in New Issue
Block a user