Update content of files

This commit is contained in:
GitHub Action 2023-12-04 21:29:41 +00:00
parent a243e03006
commit 71d1303854
3 changed files with 56 additions and 49 deletions

View file

@ -45,6 +45,7 @@
<div id="dev_page_content"><!-- scroll_nav -->
<p><a href="/api/channel">Groups</a> can be associated to a <a href="/api/channel">channel</a> as a <a href="https://telegram.org/blog/privacy-discussions-web-bots">discussion group</a>, to allow users to discuss about posts. </p>
<h3><a class="anchor" href="#channel-comments" id="channel-comments" name="channel-comments"><i class="anchor-icon"></i></a>Channel comments</h3>
<pre><code><a href='/constructor/boolFalse'>boolFalse</a>#bc799737 = <a href='/type/Bool'>Bool</a>;
<a href='/constructor/boolTrue'>boolTrue</a>#997275b5 = <a href='/type/Bool'>Bool</a>;
@ -52,14 +53,65 @@
<a href='/constructor/messages.chats'>messages.chats</a>#64ff9fd5 chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; = <a href='/type/messages.Chats'>messages.Chats</a>;
<a href='/constructor/messageReplies'>messageReplies</a>#83d60fc2 flags:<a href='/type/%23'>#</a> comments:flags.0?<a href='/constructor/true'>true</a> replies:<a href='/type/int'>int</a> replies_pts:<a href='/type/int'>int</a> recent_repliers:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Peer'>Peer</a>&gt; channel_id:flags.0?<a href='/type/long'>long</a> max_id:flags.2?<a href='/type/int'>int</a> read_max_id:flags.3?<a href='/type/int'>int</a> = <a href='/type/MessageReplies'>MessageReplies</a>;
---functions---
<a href='/method/channels.setDiscussionGroup'>channels.setDiscussionGroup</a>#40582bb2 broadcast:<a href='/type/InputChannel'>InputChannel</a> group:<a href='/type/InputChannel'>InputChannel</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/channels.getGroupsForDiscussion'>channels.getGroupsForDiscussion</a>#f5dad378 = <a href='/type/messages.Chats'>messages.Chats</a>;</code></pre>
<p>A discussion group can be associated to a channel using <a href="/method/channels.setDiscussionGroup">channels.setDiscussionGroup</a>.<br>
The discussion group can be accessed in the client by clicking on the discuss button of the channel, or by accessing the <a href="/api/threads">comment section</a> of a specific post; the discussion group ID is also present in the <code>linked_chat_id</code> field of the <a href="/constructor/channelFull">channelFull</a> constructor. </p>
<p>All messages sent to the channel will also be sent to the linked group (with sender peer <code>from_id</code> equal to the peer of the linked channel); those messages will also be automatically <a href="/api/pin">pinned</a> in the group.<br>
The comment section of a particular post can be disabled by removing the channel post message from the discussion group. </p>
<p>All messages sent to the channel will also be forwarded to the linked group (with sender peer <code>from_id</code> equal to the peer of the linked channel); those messages will also be automatically <a href="/api/pin">pinned</a> in the group. </p>
<p>The comment section of a channel post is simply the <a href="#message-threads">message thread</a> of the automatically forwarded channel message in the linked discussion supergroup.<br>
Thus, the comment section of a particular post can be disabled by removing the autoforwarded channel post message from the discussion group. </p>
<p>A <a href="/constructor/messageReplies">messageReplies</a> constructor will be attached the channel post in the original channel, containing information about the comment section, specifically:</p>
<ul>
<li><code>messageReplies.channel_id</code> will contain the ID of the linked discussion supergroup</li>
<li><code>messageReplies.recent_repliers</code> will contain information about the last few comment posters for a specific thread, to show a small list of commenter profile pictures in client previews.</li>
</ul>
<p>The same <a href="/constructor/messageReplies">messageReplies</a> constructor with the usual flags for a <a href="/api/threads">thread</a> (i.e. without <code>channel_id</code>, <code>recent_replies</code>) will also be present in the message automatically forwarded to the discussion group, as for all group messages that start a <a href="/api/threads">thread</a>. </p>
<h4><a class="anchor" href="#replies" id="replies" name="replies"><i class="anchor-icon"></i></a>@replies</h4>
<pre><code><a href='/constructor/messageFwdHeader'>messageFwdHeader</a>#5f777dce flags:<a href='/type/%23'>#</a> imported:flags.7?<a href='/constructor/true'>true</a> from_id:flags.0?<a href='/type/Peer'>Peer</a> from_name:flags.5?<a href='/type/string'>string</a> date:<a href='/type/int'>int</a> channel_post:flags.2?<a href='/type/int'>int</a> post_author:flags.3?<a href='/type/string'>string</a> saved_from_peer:flags.4?<a href='/type/Peer'>Peer</a> saved_from_msg_id:flags.4?<a href='/type/int'>int</a> psa_type:flags.6?<a href='/type/string'>string</a> = <a href='/type/MessageFwdHeader'>MessageFwdHeader</a>;
<a href='/constructor/messageReplyHeader'>messageReplyHeader</a>#a6d57763 flags:<a href='/type/%23'>#</a> reply_to_scheduled:flags.2?<a href='/constructor/true'>true</a> forum_topic:flags.3?<a href='/constructor/true'>true</a> reply_to_msg_id:<a href='/type/int'>int</a> reply_to_peer_id:flags.0?<a href='/type/Peer'>Peer</a> reply_to_top_id:flags.1?<a href='/type/int'>int</a> = <a href='/type/MessageReplyHeader'>MessageReplyHeader</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewMessage'>updateNewMessage</a>#1f2b0afd message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateNewChannelMessage'>updateNewChannelMessage</a>#62ba04d9 message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/contacts.blockFromReplies'>contacts.blockFromReplies</a>#29a8962c flags:<a href='/type/%23'>#</a> delete_message:flags.0?<a href='/constructor/true'>true</a> delete_history:flags.1?<a href='/constructor/true'>true</a> report_spam:flags.2?<a href='/constructor/true'>true</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/contacts.resolveUsername'>contacts.resolveUsername</a>#f93ccba3 username:<a href='/type/string'>string</a> = <a href='/type/contacts.ResolvedPeer'>contacts.ResolvedPeer</a>;</code></pre>
<p>Since a user can comment in channel posts without joining the actual <a href="/api/discussion">discussion supergroup</a>, there must be a way for them to receive notifications about replies in comment sections.<br>
For this reason, a special <code>@replies</code> username is provided.
Its ID for main and testing endpoints can be seen in the <a href="https://github.com/tdlib/td/blob/34cf869c02583c23b023f725dca30cd18efc82a3/td/telegram/ContactsManager.cpp#L4418">tdlib sources</a>. </p>
<p>When someone replies to one of our messages in the comment section of a channel post, and the user is not subscribed to the discussion group, the client will receive two updates:</p>
<ul>
<li>An <a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> from the discussion group itself, structured just like any other update coming from a subscribed group, with:<ul>
<li><code>id</code> set to the ID of the reply</li>
<li><code>from_id</code> set to the peer that replied to us</li>
<li><code>peer_id</code> set to the peer of the <a href="/api/discussion">discussion group</a></li>
<li><code>reply_to.reply_to_msg_id</code> set to the ID of our message</li>
<li><code>reply_to.reply_to_top_id</code> set to the <a href="/api/threads">thread ID</a>. </li>
</ul>
</li>
<li>An <a href="/constructor/updateNewMessage">updateNewMessage</a><ul>
<li><code>id</code> set to the common ID sequence for users</li>
<li><code>from_id</code> set to the peer of <code>@replies</code></li>
<li><code>peer_id</code> set to our own peer</li>
<li><code>fwd_from.saved_from_msg_id</code> set to the ID of the reply</li>
<li><code>fwd_from.from_id</code> set to the peer that replied to us</li>
<li><code>reply_to.reply_to_peer_id</code> set to the peer of the <a href="/api/discussion">discussion group</a></li>
<li><code>reply_to.reply_to_msg_id</code> set to the ID of our message</li>
<li><code>reply_to.reply_to_top_id</code> set to the <a href="/api/threads">thread ID</a></li>
</ul>
</li>
</ul>
<p>Clients should display messages coming from <code>@replies</code> as a read-only supergroup, with each reply displayed as a separate message from the author of the reply, with a "View in chat" button like for channel comments. </p>
<p><a href="/method/contacts.blockFromReplies">contacts.blockFromReplies</a> may be used to stop getting notifications about thread replies from a certain user in <code>@replies</code>.</p>
<h3><a class="anchor" href="#linking-a-discussion-group" id="linking-a-discussion-group" name="linking-a-discussion-group"><i class="anchor-icon"></i></a>Linking a discussion group</h3>
<p>To obtain a list of admined supergroups that a channel admin can possibly associate to a channel, use <a href="/method/channels.getGroupsForDiscussion">channels.getGroupsForDiscussion</a>.<br>
Returned <a href="/api/channel#basic-groups">basic group chats</a> must be first <a href="/api/channel#migration">upgraded to supergroups</a> before they can be set as a discussion group.<br>

View file

@ -62,52 +62,7 @@ Replies to messages in a thread are part of the same thread, and do not spawn ne
<p>When receiving a <a href="/constructor/message">message</a> from a group that is also the top of a thread (the message with ID <code>420</code>), the <code>replies</code> optional field will contain a <a href="/constructor/messageReplies">messageReplies</a> constructor, containing the message ID and <a href="/api/updates">PTS</a> of the latest reply in the thread, and the message ID of the latest read thread reply, along with the total number of replies in the thread. </p>
<p>Replies to a thread can also be manually fetched using <a href="/method/messages.search">messages.search</a>, providing to <code>top_msg_id</code> the thread ID. </p>
<h3><a class="anchor" href="#channel-comments" id="channel-comments" name="channel-comments"><i class="anchor-icon"></i></a>Channel comments</h3>
<pre><code><a href='/constructor/messageReplies'>messageReplies</a>#83d60fc2 flags:<a href='/type/%23'>#</a> comments:flags.0?<a href='/constructor/true'>true</a> replies:<a href='/type/int'>int</a> replies_pts:<a href='/type/int'>int</a> recent_repliers:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Peer'>Peer</a>&gt; channel_id:flags.0?<a href='/type/long'>long</a> max_id:flags.2?<a href='/type/int'>int</a> read_max_id:flags.3?<a href='/type/int'>int</a> = <a href='/type/MessageReplies'>MessageReplies</a>;</code></pre>
<p>The same <a href="/constructor/messageReplies">messageReplies</a> constructor seen above will also be contained in channel posts, this time containing information about the comment section of a specific channel post.<br>
The comment section of a channel post is simply the <a href="#message-threads">message thread</a> of the automatically forwarded channel message in the <a href="/api/discussion">linked discussion supergroup</a>; the ID of the linked discussion supergroup will be contained in the <code>messageReplies.channel_id</code> field. </p>
<p>For channel posts, the <code>recent_repliers</code> field will also contain information about the last few comment posters for a specific thread, to show a small list of commenter profile pictures in client previews.</p>
<h4><a class="anchor" href="#replies" id="replies" name="replies"><i class="anchor-icon"></i></a>@replies</h4>
<pre><code><a href='/constructor/messageFwdHeader'>messageFwdHeader</a>#5f777dce flags:<a href='/type/%23'>#</a> imported:flags.7?<a href='/constructor/true'>true</a> from_id:flags.0?<a href='/type/Peer'>Peer</a> from_name:flags.5?<a href='/type/string'>string</a> date:<a href='/type/int'>int</a> channel_post:flags.2?<a href='/type/int'>int</a> post_author:flags.3?<a href='/type/string'>string</a> saved_from_peer:flags.4?<a href='/type/Peer'>Peer</a> saved_from_msg_id:flags.4?<a href='/type/int'>int</a> psa_type:flags.6?<a href='/type/string'>string</a> = <a href='/type/MessageFwdHeader'>MessageFwdHeader</a>;
<a href='/constructor/messageReplyHeader'>messageReplyHeader</a>#a6d57763 flags:<a href='/type/%23'>#</a> reply_to_scheduled:flags.2?<a href='/constructor/true'>true</a> forum_topic:flags.3?<a href='/constructor/true'>true</a> reply_to_msg_id:<a href='/type/int'>int</a> reply_to_peer_id:flags.0?<a href='/type/Peer'>Peer</a> reply_to_top_id:flags.1?<a href='/type/int'>int</a> = <a href='/type/MessageReplyHeader'>MessageReplyHeader</a>;
<a href='/constructor/message'>message</a>#38116ee0 flags:<a href='/type/%23'>#</a> out:flags.1?<a href='/constructor/true'>true</a> mentioned:flags.4?<a href='/constructor/true'>true</a> media_unread:flags.5?<a href='/constructor/true'>true</a> silent:flags.13?<a href='/constructor/true'>true</a> post:flags.14?<a href='/constructor/true'>true</a> from_scheduled:flags.18?<a href='/constructor/true'>true</a> legacy:flags.19?<a href='/constructor/true'>true</a> edit_hide:flags.21?<a href='/constructor/true'>true</a> pinned:flags.24?<a href='/constructor/true'>true</a> noforwards:flags.26?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> from_id:flags.8?<a href='/type/Peer'>Peer</a> peer_id:<a href='/type/Peer'>Peer</a> fwd_from:flags.2?<a href='/type/MessageFwdHeader'>MessageFwdHeader</a> via_bot_id:flags.11?<a href='/type/long'>long</a> reply_to:flags.3?<a href='/type/MessageReplyHeader'>MessageReplyHeader</a> date:<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> media:flags.9?<a href='/type/MessageMedia'>MessageMedia</a> reply_markup:flags.6?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.7?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; views:flags.10?<a href='/type/int'>int</a> forwards:flags.10?<a href='/type/int'>int</a> replies:flags.23?<a href='/type/MessageReplies'>MessageReplies</a> edit_date:flags.15?<a href='/type/int'>int</a> post_author:flags.16?<a href='/type/string'>string</a> grouped_id:flags.17?<a href='/type/long'>long</a> reactions:flags.20?<a href='/type/MessageReactions'>MessageReactions</a> restriction_reason:flags.22?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; ttl_period:flags.25?<a href='/type/int'>int</a> = <a href='/type/Message'>Message</a>;
<a href='/constructor/updateNewMessage'>updateNewMessage</a>#1f2b0afd message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateNewChannelMessage'>updateNewChannelMessage</a>#62ba04d9 message:<a href='/type/Message'>Message</a> pts:<a href='/type/int'>int</a> pts_count:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/contacts.blockFromReplies'>contacts.blockFromReplies</a>#29a8962c flags:<a href='/type/%23'>#</a> delete_message:flags.0?<a href='/constructor/true'>true</a> delete_history:flags.1?<a href='/constructor/true'>true</a> report_spam:flags.2?<a href='/constructor/true'>true</a> msg_id:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/contacts.resolveUsername'>contacts.resolveUsername</a>#f93ccba3 username:<a href='/type/string'>string</a> = <a href='/type/contacts.ResolvedPeer'>contacts.ResolvedPeer</a>;</code></pre>
<p>Since a user can comment in channel posts without joining the actual <a href="/api/discussion">discussion supergroup</a>, there must be a way for them to receive notifications about replies in comment sections.<br>
For this reason, a special <code>@replies</code> username is provided.
Its ID for main and testing endpoints can be seen in the <a href="https://github.com/tdlib/td/blob/34cf869c02583c23b023f725dca30cd18efc82a3/td/telegram/ContactsManager.cpp#L4418">tdlib sources</a>. </p>
<p>When someone replies to one of our messages in the comment section of a channel post, and the user is not subscribed to the discussion group, the client will receive two updates:</p>
<ul>
<li>An <a href="/constructor/updateNewChannelMessage">updateNewChannelMessage</a> from the discussion group itself, structured just like any other update coming from a subscribed group, with:<ul>
<li><code>id</code> set to the ID of the reply</li>
<li><code>from_id</code> set to the peer that replied to us</li>
<li><code>peer_id</code> set to the peer of the <a href="/api/discussion">discussion group</a></li>
<li><code>reply_to.reply_to_msg_id</code> set to the ID of our message</li>
<li><code>reply_to.reply_to_top_id</code> set to the <a href="/api/threads">thread ID</a>. </li>
</ul>
</li>
<li>An <a href="/constructor/updateNewMessage">updateNewMessage</a><ul>
<li><code>id</code> set to the common ID sequence for users</li>
<li><code>from_id</code> set to the peer of <code>@replies</code></li>
<li><code>peer_id</code> set to our own peer</li>
<li><code>fwd_from.saved_from_msg_id</code> set to the ID of the reply</li>
<li><code>fwd_from.from_id</code> set to the peer that replied to us</li>
<li><code>reply_to.reply_to_peer_id</code> set to the peer of the <a href="/api/discussion">discussion group</a></li>
<li><code>reply_to.reply_to_msg_id</code> set to the ID of our message</li>
<li><code>reply_to.reply_to_top_id</code> set to the <a href="/api/threads">thread ID</a></li>
</ul>
</li>
</ul>
<p>Clients should display messages coming from <code>@replies</code> as a read-only supergroup, with each reply displayed as a separate message from the author of the reply, with a "View in chat" button like for channel comments. </p>
<p><a href="/method/contacts.blockFromReplies">contacts.blockFromReplies</a> may be used to stop getting notifications about thread replies from a certain user in <code>@replies</code>.</p></div>
<p>The same <a href="/constructor/messageReplies">messageReplies</a> constructor seen above will also be contained in channel posts, this time containing information about the comment section of a specific channel post, see <a href="/api/discussion">here »</a> for more info.</p></div>
</div>

View file

@ -79,7 +79,7 @@
<tr>
<td><strong>left</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.2?<a href="/constructor/true">true</a></td>
<td>Whether the current user has left this channel</td>
<td>Whether the current user has left or is not a member of this channel</td>
</tr>
<tr>
<td><strong>broadcast</strong></td>