Callbacks fixed
This commit is contained in:
parent
506c7c06c9
commit
842da9a58a
@ -83,7 +83,7 @@
|
|||||||
"button": {
|
"button": {
|
||||||
"sub_yes": "✅ Прийняти",
|
"sub_yes": "✅ Прийняти",
|
||||||
"sub_no": "❌ Відхилити",
|
"sub_no": "❌ Відхилити",
|
||||||
"sub_no_aggresive": "🤡 Відхилити (Токс)",
|
"sub_no_aggressive": "🤡 Відхилити (Токс)",
|
||||||
"sub_no_russian": "🇷🇺 Відхилити (Русак)",
|
"sub_no_russian": "🇷🇺 Відхилити (Русак)",
|
||||||
"accepted": "✅ Прийнято",
|
"accepted": "✅ Прийнято",
|
||||||
"declined": "❌ Відхилено"
|
"declined": "❌ Відхилено"
|
||||||
|
22
main.py
22
main.py
@ -1,3 +1,4 @@
|
|||||||
|
from datetime import datetime, timedelta
|
||||||
from time import time
|
from time import time
|
||||||
from os import getpid, listdir, remove
|
from os import getpid, listdir, remove
|
||||||
from modules.utils import *
|
from modules.utils import *
|
||||||
@ -102,7 +103,7 @@ async def confirm_yes(app, msg):
|
|||||||
InlineKeyboardButton(text=locale("sub_no", "button"), callback_data=f"sub_no_{msg.from_user.id}")
|
InlineKeyboardButton(text=locale("sub_no", "button"), callback_data=f"sub_no_{msg.from_user.id}")
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(text=locale("sub_no_aggresive", "button"), callback_data=f"sub_no_aggresive_{msg.from_user.id}")
|
InlineKeyboardButton(text=locale("sub_no_aggressive", "button"), callback_data=f"sub_no_aggresive_{msg.from_user.id}")
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
InlineKeyboardButton(text=locale("sub_no_russian", "button"), callback_data=f"sub_no_russian_{msg.from_user.id}")
|
InlineKeyboardButton(text=locale("sub_no_russian", "button"), callback_data=f"sub_no_russian_{msg.from_user.id}")
|
||||||
@ -137,12 +138,19 @@ async def callback_query_accept(app, clb):
|
|||||||
user_locale = clb.from_user.language_code
|
user_locale = clb.from_user.language_code
|
||||||
|
|
||||||
await app.send_message(configGet("admin_group"), f"Approved by {clb.from_user.id}")
|
await app.send_message(configGet("admin_group"), f"Approved by {clb.from_user.id}")
|
||||||
await app.send_message(int(fullclb[2]), "You got approved")
|
|
||||||
|
link = await app.create_chat_invite_link(configGet("destination_group"), name=f"Invite for {fullclb[2]}", member_limit=1, expire_date=datetime.now()+timedelta(days=1))
|
||||||
|
|
||||||
|
await app.send_message(int(fullclb[2]), "You got approved", reply_markup=InlineKeyboardMarkup(
|
||||||
|
[[
|
||||||
|
InlineKeyboardButton("Приєднатись", url=link.invite_link)
|
||||||
|
]]
|
||||||
|
))
|
||||||
|
|
||||||
edited_markup = [[InlineKeyboardButton(text=locale("accepted", "button"), callback_data="nothing")]]
|
edited_markup = [[InlineKeyboardButton(text=locale("accepted", "button"), callback_data="nothing")]]
|
||||||
|
|
||||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||||
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
await clb.answer(text=locale("sub_accepted", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("sub_no_[\s\S]*"))
|
@app.on_callback_query(filters.regex("sub_no_[\s\S]*"))
|
||||||
async def callback_query_refuse(app, clb):
|
async def callback_query_refuse(app, clb):
|
||||||
@ -156,10 +164,10 @@ async def callback_query_refuse(app, clb):
|
|||||||
edited_markup = [[InlineKeyboardButton(text=locale("declined", "button"), callback_data="nothing")]]
|
edited_markup = [[InlineKeyboardButton(text=locale("declined", "button"), callback_data="nothing")]]
|
||||||
|
|
||||||
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
|
||||||
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
await clb.answer(text=locale("sub_refused", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("sub_no_aggresive_[\s\S]*"))
|
@app.on_callback_query(filters.regex("sub_no_aggressive_[\s\S]*"))
|
||||||
async def callback_query_refuse(app, clb):
|
async def callback_query_refuse_aggressive(app, clb):
|
||||||
|
|
||||||
fullclb = clb.data.split("_")
|
fullclb = clb.data.split("_")
|
||||||
user_locale = clb.from_user.language_code
|
user_locale = clb.from_user.language_code
|
||||||
@ -173,7 +181,7 @@ async def callback_query_refuse(app, clb):
|
|||||||
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
||||||
|
|
||||||
@app.on_callback_query(filters.regex("sub_no_russian_[\s\S]*"))
|
@app.on_callback_query(filters.regex("sub_no_russian_[\s\S]*"))
|
||||||
async def callback_query_refuse(app, clb):
|
async def callback_query_refuse_russian(app, clb):
|
||||||
|
|
||||||
fullclb = clb.data.split("_")
|
fullclb = clb.data.split("_")
|
||||||
user_locale = clb.from_user.language_code
|
user_locale = clb.from_user.language_code
|
||||||
|
Reference in New Issue
Block a user