J
J
Jjran2021-08-06 15:46:21
Bots
Jjran, 2021-08-06 15:46:21

@bot.callback_query_handler how to add additional condition?

The problem is that this condition can be executed in an unnecessary place. The input here is information from the previous menu (InlineKeyboardButton buttons). What condition can be inserted here so that it is executed from the previous menu.
I will add that the previous menu for this function consists of buttons with a list of employees, and with any click, this particular function should work and only from the previous menu and in no other place

@bot.callback_query_handler(func=lambda call: True)
def callback_worker(call):
    """Функция обработки кнопок"""
    # СОТРУДНИК
    if call.data in create_list_empoyees():  # какое условие можно сюда добавить??
        selects_of_time(call)
        all_info_dict.setdefault('Сотрудник', call.data)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jjran, 2021-08-06
@Jjran

I figured it out myself. can anyone tell me

@bot.callback_query_handler(func=lambda call: True)
def callback_worker(call):
    print(call)  #text можно посмотреть вот здесь
    """Функция обработки кнопок"""
    # СОТРУДНИК
    if call.data in create_list_empoyees() and call.message.text == 'Текст который получает call':  # какое условие можно сюда добавить??
        selects_of_time(call)
        all_info_dict.setdefault('Сотрудник', call.data)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question