rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.69k stars 1.19k forks source link

How to access an old message from the chat? #356

Closed fran-mv closed 6 years ago

fran-mv commented 6 years ago

Hello, I would like to access a specific message in a supergroup to edit it and copy it. Is there any method to get the text of a message through its messageid for example?

Thx.

addo47 commented 6 years ago

I don't believe there is. I made a bot a few months ago that keeps track of message edits. I used an embedded DB and saved the last X number of messages (with their IDs and all) to keep track of.

Once a message is received by the bot, it's dropped from the server-side. Your bot must handle it in a clever manner.

fran-mv commented 6 years ago

Yes, I disabled the privacy mode for my bot but anyway the text of every message when I restart it is always null :(

Thanks for your answer ;).

ghost commented 6 years ago

@fran-mv I don't know if you are interested or not but you can try the telegram api (not bot api). Libraries:

Java: https://github.com/rubenlagus/TelegramApi (By author of this repository) Python: https://github.com/LonamiWebs/Telethon (By another author) PHP: https://github.com/danog/MadelineProto (By another author)