I am working on a project and I would like to fetch first 10 messages from a specific group topic in telegram, unfortunately I can’t find any way for this in documentation.
I am using telethon 1.30.3
.
I’ve tried to use standard TelegramClient.get_enitty
for this with a direct link to forum topic channel = await client.get_entity('https://t.me/ddostup/1118')
, but telethon failed to work with it.
2
Answers
The solution lays in internal implementation of topics by telegram. Topics are implemented as message threads, so all messages in group(forum) topic have
reply_id
being set to topic idThus this code will iterate over all messages in a group topic
simply to do it you can follow up my code :
Make sure you create a APP in the dev section and repalce the app_id as well api_hash