tg_bot/keyboards/VacancyNotificationToAdminKeyboard.py

35 lines
1.6 KiB
Python
Raw Normal View History

2024-12-06 14:20:29 +03:00
from bot.Keyboard import Keyboard
from telegram import InlineKeyboardButton
class VacancyNotificationToAdminKeyboard(Keyboard):
def get_keyboard(self):
keyboard = []
recipient = self.get_option("recipient")
post = self.get_option("post")
channel_link = post['channel_link'][1:]
channel_link = "https://t.me/{cl}".format(cl=channel_link)
post_link = "{channel_link}/{post_id}".format(channel_link=channel_link, post_id=post['post_id'])
recipient_role = recipient['status']
if recipient_role != 2:
keyboard.append([InlineKeyboardButton("Откликнуться",
callback_data='admin_respond_to_vacancy?ig_post_id={post_id}&dialog_id={dialog_id}'.format(
post_id=post['id'], dialog_id=recipient['dialog_id'])
)
])
if recipient_role == 2:
keyboard.append([InlineKeyboardButton("Открыть канал", url=channel_link)])
keyboard.append([InlineKeyboardButton("Открыть пост", url=post_link)])
if post['status'] != 5:
keyboard.append([InlineKeyboardButton("Запрос отправлен",
callback_data='request_sent?ig_post_id={post_id}'.format(
post_id=post['id'])
)
])
return keyboard