Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

How to `reply_to` works in `iter_messages()`

Open dsharma522 opened this issue 2 years ago • 3 comments

     for conv in client.iter_messages(channel.id):
           if conv.reply_to:
              original_message = conv.get_reply_message()  # get parent message this message reply to
               try:
                   #  iterate all the replies for the parent message
                    for reply in client.iter_messages(channel.id, reply_to=original_message.id):
                          print('\tReply message  -> ', reply.to_dict())
               except telethon.errors.rpcerrorlist.MsgIdInvalidError:
                         print('exception ***************')

This is not behaving as expected. When I look at the replies messages from for reply in client.iter_messages()....., the replies are having different reply_to_msg_id than id of original_message. While the method is expected to return only the messages/comments which are replies to the original_messages.

The method is returning which are not even the replies to the original message. I found this by looking at reply_to_msg_id of the replies.

dsharma522 avatar May 26 '22 09:05 dsharma522

Have you tried to check if the replies that were returned were not connected to the replies to messages that reply to the requested message?

something like this:

└── requested-message
    ├── reply-1
    │   ├── reply-1
    │   └── reply-2
    │       └── reply-1
    ├── reply-2
    └── reply-3

JSaretin avatar Jun 20 '22 23:06 JSaretin

reply_to is intended to show the "replies to" a broadcast message in its linked discussion group. That is, the comments of a post in a broadcast channel. Is that working as intended?

Lonami avatar Jun 21 '22 07:06 Lonami

Replied in the StackOverflow post. Closing since there's no bug.

Lonami avatar Sep 20 '22 12:09 Lonami