telegram-crawler/data/web/blogfork.telegram.org/api/mentions.html

156 lines
13 KiB
HTML
Raw Normal View History

2022-05-14 00:37:40 +02:00
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Mentions</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.">
<meta property="og:title" content="Mentions">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.">
<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">
2022-06-17 17:53:56 +02:00
<link href="/css/telegram.css?231" rel="stylesheet" media="screen">
2022-05-14 00:37:40 +02:00
<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/mentions" >Mentions</a></li></ul></div>
<h1 id="dev_page_title">Mentions</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows mentioning other users in case of urgent duckling matters, and quickly navigating to those mentions in order to read them as swiftly as possible.</p>
<pre><code><a href='/constructor/messageEntityMention'>messageEntityMention</a>#fa04579d offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> = <a href='/type/MessageEntity'>MessageEntity</a>;
<a href='/constructor/messageEntityMentionName'>messageEntityMentionName</a>#dc7b1140 offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> user_id:<a href='/type/long'>long</a> = <a href='/type/MessageEntity'>MessageEntity</a>;
<a href='/constructor/inputMessageEntityMentionName'>inputMessageEntityMentionName</a>#208e68c9 offset:<a href='/type/int'>int</a> length:<a href='/type/int'>int</a> user_id:<a href='/type/InputUser'>InputUser</a> = <a href='/type/MessageEntity'>MessageEntity</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/channelParticipantsMentions'>channelParticipantsMentions</a>#e04b5ceb flags:<a href='/type/%23'>#</a> q:flags.0?<a href='/type/string'>string</a> top_msg_id:flags.1?<a href='/type/int'>int</a> = <a href='/type/ChannelParticipantsFilter'>ChannelParticipantsFilter</a>;
---functions---
<a href='/method/messages.sendMessage'>messages.sendMessage</a>#d9d75a4 flags:<a href='/type/%23'>#</a> no_webpage:flags.1?<a href='/constructor/true'>true</a> silent:flags.5?<a href='/constructor/true'>true</a> background:flags.6?<a href='/constructor/true'>true</a> clear_draft:flags.7?<a href='/constructor/true'>true</a> noforwards:flags.14?<a href='/constructor/true'>true</a> peer:<a href='/type/InputPeer'>InputPeer</a> reply_to_msg_id:flags.0?<a href='/type/int'>int</a> message:<a href='/type/string'>string</a> random_id:<a href='/type/long'>long</a> reply_markup:flags.2?<a href='/type/ReplyMarkup'>ReplyMarkup</a> entities:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessageEntity'>MessageEntity</a>&gt; schedule_date:flags.10?<a href='/type/int'>int</a> send_as:flags.13?<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Updates'>Updates</a>;
<a href='/method/channels.getParticipants'>channels.getParticipants</a>#77ced9d0 channel:<a href='/type/InputChannel'>InputChannel</a> filter:<a href='/type/ChannelParticipantsFilter'>ChannelParticipantsFilter</a> offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> hash:<a href='/type/long'>long</a> = <a href='/type/channels.ChannelParticipants'>channels.ChannelParticipants</a>;</code></pre>
<p>Mentions are implemented as <a href="/api/entities">message entities</a>, passed to the <a href="/method/messages.sendMessage">messages.sendMessage</a> method:</p>
<ul>
<li><a href="/constructor/inputMessageEntityMentionName">inputMessageEntityMentionName</a> - Used when sending messages, allows mentioning a user <a href="https://t.me/botfather">inline, even for users that don't have a @username</a></li>
<li><a href="/constructor/messageEntityMentionName">messageEntityMentionName</a> - Incoming message counterpart of <a href="/constructor/inputMessageEntityMentionName">inputMessageEntityMentionName</a></li>
<li><a href="/constructor/messageEntityMention">messageEntityMention</a> - <a href="https://t.me/botfather">@botfather</a> (this entity is generated automatically server-side for @usernames in messages, no need to provide it manually)</li>
</ul>
<p>Incoming <a href="/constructor/message">messages</a> mentioning to the current user will have the <code>mentioned</code> flag set, and will contain one or more <a href="/constructor/messageEntityMention">messageEntityMention</a> and <a href="/constructor/messageEntityMentionName">messageEntityMentionName</a> constructors. </p>
<p>Graphical clients can show a list of mentionable users when the user starts entering an <code>@</code> in the text bar; for this purpose, the <a href="/constructor/channelParticipantsMentions">channelParticipantsMentions</a> filter can be used in <a href="/method/channels.getParticipants">channels.getParticipants</a>.<br>
This filter can be enhanced by providing an additional query string <code>q</code> (anything the user enters after <code>@</code>); it will also return non-participant users, in case of channel users commenting in <a href="/api/discussion">post comment sections</a>. </p>
<h3><a class="anchor" href="#dialog-mentions" id="dialog-mentions" name="dialog-mentions"><i class="anchor-icon"></i></a>Dialog mentions</h3>
<pre><code><a href='/constructor/dialog'>dialog</a>#a8edd0f5 flags:<a href='/type/%23'>#</a> pinned:flags.2?<a href='/constructor/true'>true</a> unread_mark:flags.3?<a href='/constructor/true'>true</a> peer:<a href='/type/Peer'>Peer</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> notify_settings:<a href='/type/PeerNotifySettings'>PeerNotifySettings</a> pts:flags.0?<a href='/type/int'>int</a> draft:flags.1?<a href='/type/DraftMessage'>DraftMessage</a> folder_id:flags.4?<a href='/type/int'>int</a> = <a href='/type/Dialog'>Dialog</a>;
---functions---
<a href='/method/messages.getUnreadMentions'>messages.getUnreadMentions</a>#46578472 peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> add_offset:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> max_id:<a href='/type/int'>int</a> min_id:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.readMentions'>messages.readMentions</a>#f0189d3 peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/messages.AffectedHistory'>messages.AffectedHistory</a>;</code></pre>
<p>Graphical clients are supposed to show a blue mention indicator next to the message counter of chats in the dialog list.<br>
The <a href="/constructor/dialog">dialog</a> constructor contains an <code>unread_mentions_count</code> field to isolate chats with unread mentions; the actual mention counter should be shown inside of the chat itself, above an <code>@</code> button that can be used, by clicking multiple times, to navigate back (using <a href="/method/messages.getUnreadMentions">messages.getUnreadMentions</a>) through the mention history. </p>
<p>When the last unread mention is read, or when long-clicking on the <code>@</code> button, all mentions for a chat should marked as read using <a href="/method/messages.readMentions">messages.readMentions</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/blog">Blog</a></li>
<li><a href="//telegram.org/jobs">Jobs</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/dl/android">Android</a></li>
<li><a href="//telegram.org/dl/wp">Windows Phone</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="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?46"></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>