K
K
KEEYN2021-10-07 12:05:25
Python
KEEYN, 2021-10-07 12:05:25

How to get the text of the last message using the 'telepot' library?

How to get the text of the last message in a chat using the 'telepot' library?
Through the bot.getUpdates() function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-07
@SoreMix

What chat? All messages are in the message key

response = bot.getUpdates()

for resp in response:
    print(resp['message'].get('text'))

But these are current events that have not yet been processed by the bot. If you just want to get the last message from the chat - it won't work
Well, I would advise changing the library to something more modern

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question