How to call a function and send her the chat id after clicking on InlineKeyboardButton?

There is code:
def listener(messages):
 for message in messages:
 if message.content_type == 'text':
 print(str(message.chat.first_name) +
 "[" + str(message.chat.id) + "]: "+ message.text)


bot = TeleBot(TOKEN)
bot.set_update_listener(listener)


@bot.message_handler(commands=['hot_news'])
def send_hot_news(message):
 chat_id = message.chat.id
 for i in range(1):
 keyboard = types.InlineKeyboardMarkup()
 button = types.InlineKeyboardButton(
 'Get full text', callback_data='get_full_text')
keyboard.add(button)
 txt = open('text.txt', 'rb').read()
bot.send_message(
 chat_id, txt, parse_mode='HTML', reply_markup=keyboard)

@bot.callback_query_handler(func=lambda call: True)
def callbacks(call):
 if call.data == "get_full_text":
 # here I would like to call otpravit full article
 # private message
bot.send_message(
 chat_id, 'it doesn't work because the function does not accept chat id')


Please help me
June 5th 19 at 21:08
1 answer
June 5th 19 at 21:10
Solution
if it's about function callbacks, before bot.send_message
chat_id = call.message.chat.id

Find more questions by tags PythonTelegram