telegram-crawler/data/core.telegram.org/api/search.html
2022-05-06 15:51:35 +00:00

182 lines
16 KiB
HTML

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Search</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram allows applying detailed message filters while looking for messages in chats.">
<meta property="og:title" content="Search">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram allows applying detailed message filters while looking for messages in chats.">
<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?230" 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/search" >Search</a></li></ul></div>
<h1 id="dev_page_title">Search</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram allows applying detailed message filters while looking for messages in chats.</p>
<h3><a class="anchor" href="#search-filters" id="search-filters" name="search-filters"><i class="anchor-icon"></i></a>Search filters</h3>
<pre><code><a href='/constructor/inputMessagesFilterEmpty'>inputMessagesFilterEmpty</a>#57e2f66c = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhotos'>inputMessagesFilterPhotos</a>#9609a51c = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterVideo'>inputMessagesFilterVideo</a>#9fc00e65 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhotoVideo'>inputMessagesFilterPhotoVideo</a>#56e9f0e4 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterDocument'>inputMessagesFilterDocument</a>#9eddf188 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterUrl'>inputMessagesFilterUrl</a>#7ef0dd87 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterGif'>inputMessagesFilterGif</a>#ffc86587 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterVoice'>inputMessagesFilterVoice</a>#50f5c392 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterMusic'>inputMessagesFilterMusic</a>#3751b49e = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterChatPhotos'>inputMessagesFilterChatPhotos</a>#3a20ecb8 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPhoneCalls'>inputMessagesFilterPhoneCalls</a>#80c99768 flags:<a href='/type/%23'>#</a> missed:flags.0?<a href='/constructor/true'>true</a> = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterRoundVoice'>inputMessagesFilterRoundVoice</a>#7a7c17a4 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterRoundVideo'>inputMessagesFilterRoundVideo</a>#b549da53 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterMyMentions'>inputMessagesFilterMyMentions</a>#c1f8e69a = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterGeo'>inputMessagesFilterGeo</a>#e7026d0d = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterContacts'>inputMessagesFilterContacts</a>#e062db83 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/inputMessagesFilterPinned'>inputMessagesFilterPinned</a>#1bb00451 = <a href='/type/MessagesFilter'>MessagesFilter</a>;
<a href='/constructor/messages.messages'>messages.messages</a>#8c718e87 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; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.messagesSlice'>messages.messagesSlice</a>#3a54685e flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> count:<a href='/type/int'>int</a> next_rate:flags.0?<a href='/type/int'>int</a> offset_id_offset:flags.2?<a href='/type/int'>int</a> 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; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.channelMessages'>messages.channelMessages</a>#64479808 flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> pts:<a href='/type/int'>int</a> count:<a href='/type/int'>int</a> offset_id_offset:flags.2?<a href='/type/int'>int</a> 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; = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/constructor/messages.messagesNotModified'>messages.messagesNotModified</a>#74535f21 count:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
---functions---
<a href='/method/messages.search'>messages.search</a>#a0fda762 flags:<a href='/type/%23'>#</a> peer:<a href='/type/InputPeer'>InputPeer</a> q:<a href='/type/string'>string</a> from_id:flags.0?<a href='/type/InputPeer'>InputPeer</a> top_msg_id:flags.1?<a href='/type/int'>int</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</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> hash:<a href='/type/long'>long</a> = <a href='/type/messages.Messages'>messages.Messages</a>;
<a href='/method/messages.searchGlobal'>messages.searchGlobal</a>#4bc6589a flags:<a href='/type/%23'>#</a> folder_id:flags.0?<a href='/type/int'>int</a> q:<a href='/type/string'>string</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> min_date:<a href='/type/int'>int</a> max_date:<a href='/type/int'>int</a> offset_rate:<a href='/type/int'>int</a> offset_peer:<a href='/type/InputPeer'>InputPeer</a> offset_id:<a href='/type/int'>int</a> limit:<a href='/type/int'>int</a> = <a href='/type/messages.Messages'>messages.Messages</a>;</code></pre>
<p>When using <a href="/method/messages.search">messages.search</a> or <a href="/method/messages.searchGlobal">messages.searchGlobal</a>, a certain message filter may be applied.<br>
This allows the server to filter messages based on a text query, and even on their type, and this feature is often used by graphical clients to implement features like the chat gallery, chat profile pictures and more.
Available filters:</p>
<ul>
<li><a href="/constructor/inputMessagesFilterPhotos">inputMessagesFilterPhotos</a> - Returns only photos, used for implementing the chat photo gallery, and when scrolling left or right while viewing a photo</li>
<li><a href="/constructor/inputMessagesFilterVideo">inputMessagesFilterVideo</a> - Returns only videos, used for implementing the chat video gallery, and when scrolling left or right while viewing a video</li>
<li><a href="/constructor/inputMessagesFilterPhotoVideo">inputMessagesFilterPhotoVideo</a> - Return only videos and photos, used for implementing the chat media gallery</li>
<li><a href="/constructor/inputMessagesFilterDocument">inputMessagesFilterDocument</a> - Return only videos and photos, used for implementing the chat document gallery</li>
<li><a href="/constructor/inputMessagesFilterUrl">inputMessagesFilterUrl</a> - Return only messages with links, used for implementing the chat link gallery</li>
<li><a href="/constructor/inputMessagesFilterGif">inputMessagesFilterGif</a> - Return only GIFs, used for implementing the chat GIF gallery</li>
<li><a href="/constructor/inputMessagesFilterVoice">inputMessagesFilterVoice</a> - Return only voice messages, used for implementing the chat voice message gallery, and to consecutively play voice messages in a chat</li>
<li><a href="/constructor/inputMessagesFilterMusic">inputMessagesFilterMusic</a> - Return only music files, used for implementing the chat music gallery</li>
<li><a href="/constructor/inputMessagesFilterChatPhotos">inputMessagesFilterChatPhotos</a> - Return only chat photos, used to allow scrolling through the profile picture history of a group</li>
<li><a href="/constructor/inputMessagesFilterPhoneCalls">inputMessagesFilterPhoneCalls</a> - Return only phone calls, used with <a href="/method/messages.searchGlobal">messages.searchGlobal</a> to implement the call tab, with the phone call history</li>
<li><a href="/constructor/inputMessagesFilterRoundVoice">inputMessagesFilterRoundVoice</a> - Return only round videos and voice messages, used to consecutively play round videos and voice messages in a chat</li>
<li><a href="/constructor/inputMessagesFilterRoundVideo">inputMessagesFilterRoundVideo</a> - Return only round videos, used to consecutively play round videos in a chat</li>
<li><a href="/constructor/inputMessagesFilterMyMentions">inputMessagesFilterMyMentions</a> - Return only messages mentioning me, can be used to display the <a href="/api/mentions">mention history</a> or, combined with another filter or query, return only messages that satisfy a certain criteria, and contain a mention.</li>
<li><a href="/constructor/inputMessagesFilterGeo">inputMessagesFilterGeo</a> - Return only geolocations, is used to fetch all recent valid <a href="/api/live-location">geolocations or live locations</a> sent in a group, to display them all in a single map</li>
<li><a href="/constructor/inputMessagesFilterContacts">inputMessagesFilterContacts</a> - Return only contacts</li>
<li><a href="/constructor/inputMessagesFilterPinned">inputMessagesFilterPinned</a> - Returns only <a href="/api/pin">pinned messages</a>, used for implementing the pinned message list</li>
</ul>
<p>The returned <a href="/type/messages.Messages">messages.Messages</a> constructors contain parameters for <a href="/api/offsets">pagination</a>, the messages themselves and two <code>offset_id_offset</code>/<code>count</code> parameters that can be used to display a <code>progress/total</code> counter like <code>photo 134 of 200</code>.<br>
For example, when displaying the chat photo gallery, we could display a <code>photo ${offset_id_offset} of ${count}</code> indicator on top.</p>
<h4><a class="anchor" href="#search-counters" id="search-counters" name="search-counters"><i class="anchor-icon"></i></a>Search counters</h4>
<pre><code><a href='/constructor/messages.searchCounter'>messages.searchCounter</a>#e844ebff flags:<a href='/type/%23'>#</a> inexact:flags.1?<a href='/constructor/true'>true</a> filter:<a href='/type/MessagesFilter'>MessagesFilter</a> count:<a href='/type/int'>int</a> = <a href='/type/messages.SearchCounter'>messages.SearchCounter</a>;
---functions---
<a href='/method/messages.getSearchCounters'>messages.getSearchCounters</a>#732eef00 peer:<a href='/type/InputPeer'>InputPeer</a> filters:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/MessagesFilter'>MessagesFilter</a>&gt; = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/messages.SearchCounter'>messages.SearchCounter</a>&gt;;</code></pre>
<p>Chat counters with filters can also be returned without fetching the actual messages, as seen in the schema above.</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>