tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

How to get number of comments of a message? #2795

Closed vincentneo closed 8 months ago

vincentneo commented 8 months ago

In official Telegram apps, comment buttons of a channel message are shown with the total number of comments. Is it possible to get such a count using TDLib?

screenshot showing example of comment count

Neither getMessageThread nor getMessageThreadHistory provides such a value.

Thanks!

levlam commented 8 months ago

The number of comments is shown immediately on the message, so it doesn't require any additional request in TDLib. You can find all needed data in messageInteractionInfo.reply_info. reply_count is the total number of comments, recent_replier_ids - identifiers of the users, which photos are shown. last_read_inbox_message_id can be used to identify position, from which to open the comments, and if last_read_inbox_message_id != 0 && last_message_id > last_read_inbox_message_id, then a dot that denotes new comments should be shown.

vincentneo commented 8 months ago

Thanks @levlam!