telegram-crawler/data/web/core.telegram.org/api/action-bar.html
2024-08-02 00:44:36 +00:00

214 lines
21 KiB
HTML

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Action bar</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.">
<meta property="og:title" content="Action bar">
<meta property="og:image" content="">
<meta property="og:description" content="Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.">
<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/action-bar" >Action bar</a></li></ul></div>
<h1 id="dev_page_title">Action bar</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Sometimes, when interacting with Telegram users via private or secret chats, an action bar must be shown on top of the chat, offering convenient action buttons or notices regarding the user.</p>
<p>Schema:</p>
<pre><code><a href='/constructor/peerSettings'>peerSettings</a>#a518110d flags:<a href='/type/%23'>#</a> report_spam:flags.0?<a href='/constructor/true'>true</a> add_contact:flags.1?<a href='/constructor/true'>true</a> block_contact:flags.2?<a href='/constructor/true'>true</a> share_contact:flags.3?<a href='/constructor/true'>true</a> need_contacts_exception:flags.4?<a href='/constructor/true'>true</a> report_geo:flags.5?<a href='/constructor/true'>true</a> autoarchived:flags.7?<a href='/constructor/true'>true</a> invite_members:flags.8?<a href='/constructor/true'>true</a> request_chat_broadcast:flags.10?<a href='/constructor/true'>true</a> geo_distance:flags.6?<a href='/type/int'>int</a> request_chat_title:flags.9?<a href='/type/string'>string</a> request_chat_date:flags.9?<a href='/type/int'>int</a> = <a href='/type/PeerSettings'>PeerSettings</a>;
<a href='/constructor/userFull'>userFull</a>#b9b12c6c flags:<a href='/type/%23'>#</a> blocked:flags.0?<a href='/constructor/true'>true</a> phone_calls_available:flags.4?<a href='/constructor/true'>true</a> phone_calls_private:flags.5?<a href='/constructor/true'>true</a> can_pin_message:flags.7?<a href='/constructor/true'>true</a> has_scheduled:flags.12?<a href='/constructor/true'>true</a> video_calls_available:flags.13?<a href='/constructor/true'>true</a> voice_messages_forbidden:flags.20?<a href='/constructor/true'>true</a> translations_disabled:flags.23?<a href='/constructor/true'>true</a> stories_pinned_available:flags.26?<a href='/constructor/true'>true</a> blocked_my_stories_from:flags.27?<a href='/constructor/true'>true</a> wallpaper_overridden:flags.28?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> about:flags.1?<a href='/type/string'>string</a> settings:<a href='/type/PeerSettings'>PeerSettings</a> personal_photo:flags.21?<a href='/type/Photo'>Photo</a> profile_photo:flags.2?<a href='/type/Photo'>Photo</a> fallback_photo:flags.22?<a href='/type/Photo'>Photo</a> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> bot_info:flags.3?<a href='/type/BotInfo'>BotInfo</a> pinned_msg_id:flags.6?<a href='/type/int'>int</a> common_chats_count:<a href='/type/int'>int</a> folder_id:flags.11?<a href='/type/int'>int</a> ttl_period:flags.14?<a href='/type/int'>int</a> theme_emoticon:flags.15?<a href='/type/string'>string</a> private_forward_name:flags.16?<a href='/type/string'>string</a> bot_group_admin_rights:flags.17?<a href='/type/ChatAdminRights'>ChatAdminRights</a> bot_broadcast_admin_rights:flags.18?<a href='/type/ChatAdminRights'>ChatAdminRights</a> premium_gifts:flags.19?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PremiumGiftOption'>PremiumGiftOption</a>&gt; wallpaper:flags.24?<a href='/type/WallPaper'>WallPaper</a> stories:flags.25?<a href='/type/PeerStories'>PeerStories</a> = <a href='/type/UserFull'>UserFull</a>;
<a href='/constructor/updatePeerSettings'>updatePeerSettings</a>#6a7e7366 peer:<a href='/type/Peer'>Peer</a> settings:<a href='/type/PeerSettings'>PeerSettings</a> = <a href='/type/Update'>Update</a>;
<a href='/constructor/messages.peerSettings'>messages.peerSettings</a>#6880b94d settings:<a href='/type/PeerSettings'>PeerSettings</a> 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; = <a href='/type/messages.PeerSettings'>messages.PeerSettings</a>;
---functions---
<a href='/method/messages.getPeerSettings'>messages.getPeerSettings</a>#efd9a6a2 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.PeerSettings'>messages.PeerSettings</a>;
<a href='/method/messages.hidePeerSettingsBar'>messages.hidePeerSettingsBar</a>#4facb138 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>The action bar is represented by the <a href="/constructor/peerSettings">peerSettings</a> constructor, fetchable using <a href="/method/messages.getPeerSettings">messages.getPeerSettings</a>; it is also contained in the <a href="/constructor/userFull">userFull</a> constructor returned by <a href="/method/users.getFullUser">users.getFullUser</a>.</p>
<p>Changes to the chat bar may also be notified by the server using <a href="/constructor/updatePeerSettings">updatePeerSettings</a>. </p>
<p>The currently active action bar may also be dismissed using <a href="/method/messages.hidePeerSettingsBar">messages.hidePeerSettingsBar</a>. </p>
<p>What follows is a list of the various (<em>mutually exclusive</em>) chat bar types, along with the <strong>condition</strong> used to identify each type, by checking the appropriate flags of <a href="/constructor/peerSettings">peerSettings</a>. </p>
<h3><a class="anchor" href="#report-spam-block-or-add-contact" id="report-spam-block-or-add-contact" name="report-spam-block-or-add-contact"><i class="anchor-icon"></i></a>Report spam, block or add contact</h3>
<pre><code><a href='/constructor/inputReportReasonSpam'>inputReportReasonSpam</a>#58dbcab8 = <a href='/type/ReportReason'>ReportReason</a>;
---functions---
<a href='/method/account.reportPeer'>account.reportPeer</a>#c5ba3d86 peer:<a href='/type/InputPeer'>InputPeer</a> reason:<a href='/type/ReportReason'>ReportReason</a> message:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/contacts.addContact'>contacts.addContact</a>#e8f463d0 flags:<a href='/type/%23'>#</a> add_phone_privacy_exception:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/InputUser'>InputUser</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> phone:<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/contacts.block'>contacts.block</a>#2e2e8734 flags:<a href='/type/%23'>#</a> my_stories_from:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>This action bar, associated to a private or secret chat, offers the user buttons to:</p>
<ul>
<li>Report the chat for spam using <a href="/method/account.reportPeer">account.reportPeer</a> and <a href="/constructor/inputReportReasonSpam">inputReportReasonSpam</a>.<br>
If the other user has an emoji status, then the bar should also show a notice, indicating that the emoji status is shown next to the user's name because they have purchased <a href="/api/premium">Telegram Premium</a> (i.e. this is useful to avoid issues if the user uses an emoji status similar to a verified checkmark).<br>
Additionally, if the chat was automatically <a href="/api/folders#peer-folders">archived »</a> (according to <a href="/constructor/peerSettings">peerSettings</a>.<code>autoarchived</code>), an extra button can be shown to unarchive the chat <a href="/api/folders#peer-folders">as specified here »</a> instead of reporting it.</li>
<li>Add the other user of the chat to the contact list using <a href="/method/contacts.addContact">contacts.addContact</a>.<br>
Optionally, the <a href="/constructor/peerSettings">peerSettings</a>.<code>need_contacts_exception</code> flag may also be set: if so, the <code>add_phone_privacy_exception</code> flag <strong>must</strong> be set if the user clicks on the add contact button, invoking <a href="/method/contacts.addContact">contacts.addContact</a>. </li>
<li>Block the other user of the chat from writing to us using <a href="/method/contacts.block">contacts.block</a> (without setting the <code>my_stories_from</code> flag). </li>
</ul>
<p><strong>Condition</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>report_spam</code>, <a href="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code>, <a href="/constructor/peerSettings">peerSettings</a>.<code>block_contact</code> flags must all be set.</p>
<p>Additionally, if the <a href="/constructor/peerSettings">peerSettings</a>.<code>geo_distance</code> flag is set, the bar should also display the distance between us and the user, indicating that the user found us by invoking <a href="/method/contacts.getLocated">contacts.getLocated</a>, because we are currently advertising our location with the same method.</p>
<h3><a class="anchor" href="#report-spam-or-unarchive" id="report-spam-or-unarchive" name="report-spam-or-unarchive"><i class="anchor-icon"></i></a>Report spam or unarchive</h3>
<pre><code><a href='/constructor/inputReportReasonSpam'>inputReportReasonSpam</a>#58dbcab8 = <a href='/type/ReportReason'>ReportReason</a>;
---functions---
<a href='/method/account.reportPeer'>account.reportPeer</a>#c5ba3d86 peer:<a href='/type/InputPeer'>InputPeer</a> reason:<a href='/type/ReportReason'>ReportReason</a> message:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>This action bar, associated to a private or secret chat, offers the user a button to report the chat for spam using <a href="/method/account.reportPeer">account.reportPeer</a> and <a href="/constructor/inputReportReasonSpam">inputReportReasonSpam</a>. </p>
<p>If the other user has an emoji status, then the bar should also show a notice, indicating that the emoji status is shown next to the user's name because they have purchased <a href="/api/premium">Telegram Premium</a> (i.e. this is useful to avoid issues if the user uses an emoji status similar to a verified checkmark). </p>
<p><strong>Condition</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>report_spam</code> flag must be set, and the <a href="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code>, <a href="/constructor/peerSettings">peerSettings</a>.<code>block_contact</code> flags must <strong>not</strong> be set.</p>
<p>Additionally, if the chat was automatically <a href="/api/folders#peer-folders">archived »</a> (according to <a href="/constructor/peerSettings">peerSettings</a>.<code>autoarchived</code>), an extra button can be shown to unarchive the chat <a href="/api/folders#peer-folders">as specified here »</a> instead of reporting it.</p>
<h3><a class="anchor" href="#add-contact" id="add-contact" name="add-contact"><i class="anchor-icon"></i></a>Add contact</h3>
<pre><code>---functions---
<a href='/method/contacts.addContact'>contacts.addContact</a>#e8f463d0 flags:<a href='/type/%23'>#</a> add_phone_privacy_exception:flags.0?<a href='/constructor/true'>true</a> id:<a href='/type/InputUser'>InputUser</a> first_name:<a href='/type/string'>string</a> last_name:<a href='/type/string'>string</a> phone:<a href='/type/string'>string</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>This action bar, associated to a private or secret chat, offers the user a button to add the other user of the chat to the contact list using <a href="/method/contacts.addContact">contacts.addContact</a>. </p>
<p><strong>Conditions</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>add_contact</code> flag must be set <strong>and</strong>:</p>
<ul>
<li>For secret chats, the chat must <strong>not</strong> be archived.</li>
<li>For private chats, the <code>block_contact</code> and <code>report_spam</code> flags must <strong>not</strong> be set.</li>
</ul>
<p>Optionally, the <a href="/constructor/peerSettings">peerSettings</a>.<code>need_contacts_exception</code> flag may also be set: if so, the <code>add_phone_privacy_exception</code> flag <strong>must</strong> be set if the user clicks on the add contact button, invoking <a href="/method/contacts.addContact">contacts.addContact</a>. </p>
<h3><a class="anchor" href="#share-phone-number" id="share-phone-number" name="share-phone-number"><i class="anchor-icon"></i></a>Share phone number</h3>
<pre><code>---functions---
<a href='/method/contacts.acceptContact'>contacts.acceptContact</a>#f831a20f id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>This action bar, associated to a private or secret chat, offers the user a button to share their phone number with the other user using <a href="/method/contacts.acceptContact">contacts.acceptContact</a>. </p>
<p><strong>Condition</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>share_contact</code> flag must be set.</p>
<p>This flag is set and the bar is activated only if the other user has added us as a contact using <a href="/method/contacts.addContact">contacts.addContact</a>, without using a phone number, and none of the <code>add_contact</code>, <code>report_spam</code>, <code>block_contact</code> flags are set.</p>
<h3><a class="anchor" href="#report-irrelevant-geolocation" id="report-irrelevant-geolocation" name="report-irrelevant-geolocation"><i class="anchor-icon"></i></a>Report irrelevant geolocation</h3>
<pre><code><a href='/constructor/inputReportReasonGeoIrrelevant'>inputReportReasonGeoIrrelevant</a>#dbd4feed = <a href='/type/ReportReason'>ReportReason</a>;
---functions---
<a href='/method/account.reportPeer'>account.reportPeer</a>#c5ba3d86 peer:<a href='/type/InputPeer'>InputPeer</a> reason:<a href='/type/ReportReason'>ReportReason</a> message:<a href='/type/string'>string</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>This bar indicates that the associated location-based supergroup can be reported for having an unrelated location using a bar button that invokes <a href="/method/account.reportPeer">account.reportPeer</a> with <code>reason</code> <a href="/constructor/inputReportReasonGeoIrrelevant">inputReportReasonGeoIrrelevant</a>. </p>
<p><strong>Condition</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>report_geo</code> flag must be set.</p>
<h3><a class="anchor" href="#invite-new-members" id="invite-new-members" name="invite-new-members"><i class="anchor-icon"></i></a>Invite new members</h3>
<pre><code>---functions---
<a href='/method/messages.addChatUser'>messages.addChatUser</a>#f24753e3 chat_id:<a href='/type/long'>long</a> user_id:<a href='/type/InputUser'>InputUser</a> fwd_limit:<a href='/type/int'>int</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.inviteToChannel'>channels.inviteToChannel</a>#199f3a6c channel:<a href='/type/InputChannel'>InputChannel</a> users:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputUser'>InputUser</a>&gt; = <a href='/type/Updates'>Updates</a>;</code></pre>
<p>This bar indicates that the associated group was created recently, and it offers a bar button to invite new members using <a href="/method/messages.addChatUser">messages.addChatUser</a> or <a href="/method/channels.inviteToChannel">channels.inviteToChannel</a>, depending on whether the associated peer is a <a href="/api/channel">group or a supergroup</a>.</p>
<p><strong>Condition</strong>: the <a href="/constructor/peerSettings">peerSettings</a>.<code>invite_members</code> flag must be set.</p>
<h3><a class="anchor" href="#an-admin-from-a-recent-join-request-is-contacting-you" id="an-admin-from-a-recent-join-request-is-contacting-you" name="an-admin-from-a-recent-join-request-is-contacting-you"><i class="anchor-icon"></i></a>An admin from a recent join request is contacting you</h3>
<p>This bar indicates that the associated private or secret chat is a chat with an administrator of a <a href="/api/channel">group or channel</a> to which the user sent a <a href="/api/invites#join-requests">join request, see here for more info on join requests »</a>. </p>
<p><strong>Condition</strong>: the <code>request_chat_title</code> and <code>request_chat_date</code> fields of <a href="/constructor/peerSettings">peerSettings</a> must both be set; optionally <code>request_chat_broadcast</code> may also be set:</p>
<ul>
<li><code>request_chat_title</code> - Contains the group/channel's title.</li>
<li><code>request_chat_date</code> - Contains the timestamp indicating when the join request was sent.</li>
<li><code>request_chat_broadcast</code> - This flag is set if the join request is related to a channel (otherwise, the join request is related to a group).</li>
</ul></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>