R
R
r1dddy4sv2020-12-03 14:57:56
Python
r1dddy4sv, 2020-12-03 14:57:56

How to get the last message ID of pyTelegramBotAPI?

I need to know and remember the id of the message sent by the bot

I heard that the messages.sendMessage method could help me, but after looking at the documentation, I didn’t quite understand how it works

please explain how the messages.sendMessage method works or suggest your own version

Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Ternick, 2020-12-03
@r1dddy4sv

1) What messages.sendMessage is, there is no such thing and never was, there is only bot.send_message, and bot = TeleBot(config["apiKey"], threaded = False).
2) bot.send_message returns any rubbish, including the id of the message just sent.

@bot.message_handler(commands=['start'])
def start(message):
  print(bot.send_message(message.chat.id, "tess").message_id)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question