S
S
swpavlov2020-11-01 02:23:16
Python
swpavlov, 2020-11-01 02:23:16

How to pass an additional element to the callback function?

How can I pass the user's message to the callback function?

@bot.message_handler(content_types=["text"])
def repeat_all_messages(message):
   callbacks(message.text)

@bot.callback_query_handler(func=lambda call: True)
def callbacks(call, cards):
    if call.data == "statTop":
        bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
                              text=f"Спасибо, <code>{call.message.chat.username}</code>, за оценку!",
                              parse_mode='html')
        print(cards)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question