telegram-crawler/data/web/blogfork.telegram.org/api/forum.html
2024-09-17 22:21:45 +00:00

187 lines
21 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Forums</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows creating forums with multiple distinct topics.">
<meta property="og:title" content="Forums">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows creating forums with multiple distinct topics.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?240" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/forum" >Forums</a></li></ul></div>
<h1 id="dev_page_title">Forums</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows creating forums with multiple distinct topics.</p>
<pre><code><a href='/constructor/channel'>channel</a>#aadfc8f flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> left:flags.2?<a href='/constructor/true'>true</a> broadcast:flags.5?<a href='/constructor/true'>true</a> verified:flags.7?<a href='/constructor/true'>true</a> megagroup:flags.8?<a href='/constructor/true'>true</a> restricted:flags.9?<a href='/constructor/true'>true</a> signatures:flags.11?<a href='/constructor/true'>true</a> min:flags.12?<a href='/constructor/true'>true</a> scam:flags.19?<a href='/constructor/true'>true</a> has_link:flags.20?<a href='/constructor/true'>true</a> has_geo:flags.21?<a href='/constructor/true'>true</a> slowmode_enabled:flags.22?<a href='/constructor/true'>true</a> call_active:flags.23?<a href='/constructor/true'>true</a> call_not_empty:flags.24?<a href='/constructor/true'>true</a> fake:flags.25?<a href='/constructor/true'>true</a> gigagroup:flags.26?<a href='/constructor/true'>true</a> noforwards:flags.27?<a href='/constructor/true'>true</a> join_to_send:flags.28?<a href='/constructor/true'>true</a> join_request:flags.29?<a href='/constructor/true'>true</a> forum:flags.30?<a href='/constructor/true'>true</a> flags2:<a href='/type/%23'>#</a> stories_hidden:flags2.1?<a href='/constructor/true'>true</a> stories_hidden_min:flags2.2?<a href='/constructor/true'>true</a> stories_unavailable:flags2.3?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:flags.13?<a href='/type/long'>long</a> title:<a href='/type/string'>string</a> username:flags.6?<a href='/type/string'>string</a> photo:<a href='/type/ChatPhoto'>ChatPhoto</a> date:<a href='/type/int'>int</a> restriction_reason:flags.9?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/RestrictionReason'>RestrictionReason</a>&gt; admin_rights:flags.14?<a href='/type/ChatAdminRights'>ChatAdminRights</a> banned_rights:flags.15?<a href='/type/ChatBannedRights'>ChatBannedRights</a> default_banned_rights:flags.18?<a href='/type/ChatBannedRights'>ChatBannedRights</a> participants_count:flags.17?<a href='/type/int'>int</a> usernames:flags2.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Username'>Username</a>&gt; stories_max_id:flags2.4?<a href='/type/int'>int</a> color:flags2.7?<a href='/type/PeerColor'>PeerColor</a> profile_color:flags2.8?<a href='/type/PeerColor'>PeerColor</a> emoji_status:flags2.9?<a href='/type/EmojiStatus'>EmojiStatus</a> level:flags2.10?<a href='/type/int'>int</a> = <a href='/type/Chat'>Chat</a>;
---functions---
<a href='/method/channels.createChannel'>channels.createChannel</a>#91006707 flags:<a href='/type/%23'>#</a> broadcast:flags.0?<a href='/constructor/true'>true</a> megagroup:flags.1?<a href='/constructor/true'>true</a> for_import:flags.3?<a href='/constructor/true'>true</a> forum:flags.5?<a href='/constructor/true'>true</a> title:<a href='/type/string'>string</a> about:<a href='/type/string'>string</a> geo_point:flags.2?<a href='/type/InputGeoPoint'>InputGeoPoint</a> address:flags.2?<a href='/type/string'>string</a> ttl_period:flags.4?<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.toggleForum'>channels.toggleForum</a>#a4298b29 channel:<a href='/type/InputChannel'>InputChannel</a> enabled:<a href='/type/Bool'>Bool</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Forums may be created either by invoking <a href="/method/channels.createChannel">channels.createChannel</a> with the <code>forum</code> flag set, or by converting an existing <a href="/api/channel">supergroup</a> into a forum using <a href="/method/channels.toggleForum">channels.toggleForum</a> with <code>enabled=true</code>.<br>
If the group is a <a href="/api/channel#basic-groups">basic group</a>, it should be <a href="/api/channel#migration">upgraded to a supergroup</a> before converting it into a forum. </p>
<p>Forums can also be converted back to <a href="/api/channel">supergroups</a> using <a href="/method/channels.toggleForum">channels.toggleForum</a> with <code>enabled=false</code>. </p>
<p>Note that the <a href="/method/channels.toggleForum">channels.toggleForum</a> method can only be invoked by admins with owner rights.</p>
<p>Forums have the <a href="/constructor/channel">channel</a>.<code>forum</code> flag set, and conversation happens in distinct <a href="#forum-topics">forum topics</a>.</p>
<h4><a class="anchor" href="#forum-topics" id="forum-topics" name="forum-topics"><i class="anchor-icon"></i></a>Forum topics</h4>
<pre><code><a href='/constructor/forumTopic'>forumTopic</a>#71701da9 flags:<a href='/type/%23'>#</a> my:flags.1?<a href='/constructor/true'>true</a> closed:flags.2?<a href='/constructor/true'>true</a> pinned:flags.3?<a href='/constructor/true'>true</a> short:flags.5?<a href='/constructor/true'>true</a> hidden:flags.6?<a href='/constructor/true'>true</a> id:<a href='/type/int'>int</a> date:<a href='/type/int'>int</a> title:<a href='/type/string'>string</a> icon_color:<a href='/type/int'>int</a> icon_emoji_id:flags.0?<a href='/type/long'>long</a> top_message:<a href='/type/int'>int</a> read_inbox_max_id:<a href='/type/int'>int</a> read_outbox_max_id:<a href='/type/int'>int</a> unread_count:<a href='/type/int'>int</a> unread_mentions_count:<a href='/type/int'>int</a> unread_reactions_count:<a href='/type/int'>int</a> from_id:<a href='/type/Peer'>Peer</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> draft:flags.4?<a href='/type/DraftMessage'>DraftMessage</a> = <a href='/type/ForumTopic'>ForumTopic</a>;
<a href='/constructor/forumTopicDeleted'>forumTopicDeleted</a>#023f109b id:<a href='/type/int'>int</a> = <a href='/type/ForumTopic'>ForumTopic</a>;
<a href='/constructor/messages.forumTopics'>messages.forumTopics</a>#367617d3 flags:<a href='/type/%23'>#</a> order_by_create_date:flags.0?<a href='/constructor/true'>true</a> count:<a href='/type/int'>int</a> topics:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ForumTopic'>ForumTopic</a>&gt; messages:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Message'>Message</a>&gt; chats:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Chat'>Chat</a>&gt; users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/User'>User</a>&gt; pts:<a href='/type/int'>int</a> = <a href='/type/messages.ForumTopics'>messages.ForumTopics</a>;
<a href='/constructor/inputStickerSetEmojiDefaultTopicIcons'>inputStickerSetEmojiDefaultTopicIcons</a>#44c1f8e9 = <a href='/type/InputStickerSet'>InputStickerSet</a>;
<a href='/constructor/messageActionTopicCreate'>messageActionTopicCreate</a>#0d999256 flags:<a href='/type/%23'>#</a> title:<a href='/type/string'>string</a> icon_color:<a href='/type/int'>int</a> icon_emoji_id:flags.0?<a href='/type/long'>long</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/messageActionTopicEdit'>messageActionTopicEdit</a>#c0944820 flags:<a href='/type/%23'>#</a> title:flags.0?<a href='/type/string'>string</a> icon_emoji_id:flags.1?<a href='/type/long'>long</a> closed:flags.2?<a href='/type/Bool'>Bool</a> hidden:flags.3?<a href='/type/Bool'>Bool</a> = <a href='/type/MessageAction'>MessageAction</a>;
<a href='/constructor/updateChannelPinnedTopic'>updateChannelPinnedTopic</a>#192efbe3 flags:<a href='/type/%23'>#</a> pinned:flags.0?<a href='/constructor/true'>true</a> channel_id:<a href='/type/long'>long</a> topic_id:<a href='/type/int'>int</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/updateChannelPinnedTopics'>updateChannelPinnedTopics</a>#fe198602 flags:<a href='/type/%23'>#</a> channel_id:<a href='/type/long'>long</a> order:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Update'>Update</a>;
<a href='/constructor/inputReplyToMessage'>inputReplyToMessage</a>#22c0f6d5 flags:<a href='/type/%23'>#</a> reply_to_msg_id:<a href='/type/int'>int</a> top_msg_id:flags.0?<a href='/type/int'>int</a> reply_to_peer_id:flags.1?<a href='/type/InputPeer'>InputPeer</a> quote_text:flags.2?<a href='/type/string'>string</a> quote_entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; quote_offset:flags.4?<a href='/type/int'>int</a> = <a href='/type/InputReplyTo'>InputReplyTo</a>;
---functions---
<a href='/method/channels.getForumTopics'>channels.getForumTopics</a>#0de560d1 flags:<a href='/type/%23'>#</a> channel:<a href='/type/InputChannel'>InputChannel</a> q:flags.0?<a href='/type/string'>string</a> offset_date:<a href='/type/int'>int</a> offset_id:<a href='/type/int'>int</a> offset_topic:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.ForumTopics'>messages.ForumTopics</a>;
<a href='/method/channels.getForumTopicsByID'>channels.getForumTopicsByID</a>#b0831eb9 channel:<a href='/type/InputChannel'>InputChannel</a> topics:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/messages.ForumTopics'>messages.ForumTopics</a>;
<a href='/method/channels.deleteTopicHistory'>channels.deleteTopicHistory</a>#34435f2d channel:<a href='/type/InputChannel'>InputChannel</a> top_msg_id:<a href='/type/int'>int</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;
<a href='/method/channels.createForumTopic'>channels.createForumTopic</a>#f40c0224 flags:<a href='/type/%23'>#</a> channel:<a href='/type/InputChannel'>InputChannel</a> title:<a href='/type/string'>string</a> icon_color:flags.0?<a href='/type/int'>int</a> icon_emoji_id:flags.3?<a href='/type/long'>long</a> random_id:<a href='/type/long'>long</a> send_as:flags.2?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.editForumTopic'>channels.editForumTopic</a>#f4dfa185 flags:<a href='/type/%23'>#</a> channel:<a href='/type/InputChannel'>InputChannel</a> topic_id:<a href='/type/int'>int</a> title:flags.0?<a href='/type/string'>string</a> icon_emoji_id:flags.1?<a href='/type/long'>long</a> closed:flags.2?<a href='/type/Bool'>Bool</a> hidden:flags.3?<a href='/type/Bool'>Bool</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.updatePinnedForumTopic'>channels.updatePinnedForumTopic</a>#6c2d9026 channel:<a href='/type/InputChannel'>InputChannel</a> topic_id:<a href='/type/int'>int</a> pinned:<a href='/type/Bool'>Bool</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.reorderPinnedForumTopics'>channels.reorderPinnedForumTopics</a>#2950a18f flags:<a href='/type/%23'>#</a> force:flags.0?<a href='/constructor/true'>true</a> channel:<a href='/type/InputChannel'>InputChannel</a> order:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.toggleViewForumAsMessages'>channels.toggleViewForumAsMessages</a>#9738bb15 channel:<a href='/type/InputChannel'>InputChannel</a> enabled:<a href='/type/Bool'>Bool</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>Forums can have multiple topics where users may interact. </p>
<p>To fetch the topic list of a forum, use <a href="/method/channels.getForumTopics">channels.getForumTopics</a>; the same method can be used to search topics by their name.<br>
To fetch information about one or more topics by their ID, use <a href="/method/channels.getForumTopicsByID">channels.getForumTopicsByID</a>. </p>
<p>Every forum has a non-deletable "General" topic, with <code>id=1</code>; other topics will have other IDs, equal to the <a href="/constructor/messageActionTopicCreate">messageActionTopicCreate</a> service message that created the topic. </p>
<p>To send messages to the "General" topic, just use <a href="/method/messages.sendMessage">messages.sendMessage</a> as usual, as if you were writing to a normal supergroup.<br>
On the other hand, topics with <code>id != 1</code> are just the <a href="/api/threads">message thread</a> of the <a href="/constructor/messageActionTopicCreate">messageActionTopicCreate</a> service message that created that topic.<br>
This means that topics should be treated similarly to <a href="/api/threads">message threads</a> by the client.<br>
To send messages to these topics, pass the topic ID to the <code>reply_to_msg_id</code> parameter of <a href="/constructor/inputReplyToMessage">inputReplyToMessage</a>, passed to <code>reply_to</code> when invoking <a href="/method/messages.sendMessage">messages.sendMessage</a>, <a href="/method/messages.sendMedia">messages.sendMedia</a> et cetera. </p>
<p>To reply to messages within a topic, pass the ID of the message to reply to <a href="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>reply_to_msg_id</code>, and, unless we're replying to a message in the "General" topic, pass the topic ID to <a href="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>top_msg_id</code>.<br>
Note that when replying to messages in a topic, the <a href="/constructor/inputReplyToMessage">inputReplyToMessage</a>.<code>top_msg_id</code> field must contain the topic ID <strong>if and only if</strong> we're replying to messages in <a href="/api/forum#forum-topics">forum topics</a> different from the "General" topic (i.e. <code>reply_to_msg_id</code> is set and <code>reply_to_msg_id != topicID</code> and <code>topicID != 1</code>): this way, if the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic.<br>
Also note that since <a href="/api/threads">message threads</a> can't have nested message threads, topics (except for the "General" topic) also can't have message threads (so replies to messages within topics won't generate further message threads). </p>
<p>Topics have a name (<code>title</code>) and an icon: the icon can be a <a href="/api/custom-emoji">custom emoji</a> specified by the <code>icon_emoji_id</code>, or a default chat icon if <code>icon_emoji_id</code> is not set, filled with the color specified in <code>icon_color</code>.<br>
Topics can be temporarily <code>closed</code>, preventing further messages from being sent to the topic.<br>
Additionally, (only) the "General" topic may also be <code>hidden</code>.<br>
All topics except for the "General" topic can be deleted by invoking <a href="/method/channels.deleteTopicHistory">channels.deleteTopicHistory</a>, with the topic ID. </p>
<p>Topics can be created by using the <a href="/method/channels.createForumTopic">channels.createForumTopic</a> method, and may be modified with the <a href="/method/channels.editForumTopic">channels.editForumTopic</a> method: these actions require <a href="/api/rights"><code>manage_topics</code> rights</a>, and will generate <a href="/constructor/messageActionTopicCreate">messageActionTopicCreate</a>/<a href="/constructor/messageActionTopicEdit">messageActionTopicEdit</a> service messages. </p>
<p>Note that <a href="/api/premium">Telegram Premium</a> users can pass any custom emoji to <code>icon_emoji_id</code>, while other users can only use the custom emojis contained in the <a href="/constructor/inputStickerSetEmojiDefaultTopicIcons">inputStickerSetEmojiDefaultTopicIcons</a> emoji pack.<br>
If the default chat icon is used, its color cannot be modified after creating the topic. </p>
<p>Topics may be pinned or unpinned using <a href="/method/channels.updatePinnedForumTopic">channels.updatePinnedForumTopic</a>; use <a href="/method/channels.reorderPinnedForumTopics">channels.reorderPinnedForumTopics</a> to reorder pinned topics.<br>
You can pin at most <code>topics_pinned_limit</code> topics per forum, as specified by the <a href="/api/config#client-configuration">client configuration parameters »</a>.</p>
<p>Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.<br>
This setting only affects the current account, and is synced to other logged in sessions using the <a href="/method/channels.toggleViewForumAsMessages">channels.toggleViewForumAsMessages</a> method; invoking this method will update the value of the <code>view_forum_as_messages</code> flag of <a href="/constructor/channelFull">channelFull</a> or <a href="/constructor/dialog">dialog</a> and emit an <a href="/constructor/updateChannelViewForumAsMessages">updateChannelViewForumAsMessages</a>.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/privacy">Privacy</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/android">Android</a></li>
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/press">Press</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?47"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>