mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-23 15:58:27 +01:00
158 lines
11 KiB
HTML
158 lines
11 KiB
HTML
<!DOCTYPE html>
|
||
<html class="">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Top peer rating</title>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta property="description" content="If enabled, the rating of top peers indicates the relevance of a frequently used peer in a certain category (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).">
|
||
<meta property="og:title" content="Top peer rating">
|
||
<meta property="og:image" content="34465abeb3bc2c4844">
|
||
<meta property="og:description" content="If enabled, the rating of top peers indicates the relevance of a frequently used peer in a certain category (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).">
|
||
<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?241" 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/top-rating" >Top peer rating</a></li></ul></div>
|
||
<h1 id="dev_page_title">Top peer rating</h1>
|
||
|
||
<div id="dev_page_content"><p>If <a href="/method/contacts.toggleTopPeers">enabled</a>, the rating of <a href="/constructor/topPeer">top peers</a> indicates the relevance of a frequently used peer in a certain <a href="/type/TopPeerCategory">category</a> (frequently messaged users, frequently used bots, inline bots, frequently visited channels and so on).</p>
|
||
<p>Schema: </p>
|
||
<pre><code><a href='/constructor/topPeerCategoryBotsPM'>topPeerCategoryBotsPM</a>#ab661b5b = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryBotsInline'>topPeerCategoryBotsInline</a>#148677e2 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryCorrespondents'>topPeerCategoryCorrespondents</a>#637b7ed = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryGroups'>topPeerCategoryGroups</a>#bd17a14a = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryChannels'>topPeerCategoryChannels</a>#161d9628 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryPhoneCalls'>topPeerCategoryPhoneCalls</a>#1e76a78c = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryForwardUsers'>topPeerCategoryForwardUsers</a>#a8406ca9 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryForwardChats'>topPeerCategoryForwardChats</a>#fbeec0f0 = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
<a href='/constructor/topPeerCategoryBotsApp'>topPeerCategoryBotsApp</a>#fd9e7bec = <a href='/type/TopPeerCategory'>TopPeerCategory</a>;
|
||
|
||
<a href='/constructor/topPeer'>topPeer</a>#edcdc05b peer:<a href='/type/Peer'>Peer</a> rating:<a href='/type/double'>double</a> = <a href='/type/TopPeer'>TopPeer</a>;
|
||
|
||
<a href='/constructor/topPeerCategoryPeers'>topPeerCategoryPeers</a>#fb834291 category:<a href='/type/TopPeerCategory'>TopPeerCategory</a> count:<a href='/type/int'>int</a> peers:<a href='/type/Vector%20t'>Vector</a><<a href='/type/TopPeer'>TopPeer</a>> = <a href='/type/TopPeerCategoryPeers'>TopPeerCategoryPeers</a>;
|
||
|
||
<a href='/constructor/contacts.topPeersNotModified'>contacts.topPeersNotModified</a>#de266ef5 = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
|
||
<a href='/constructor/contacts.topPeers'>contacts.topPeers</a>#70b772a8 categories:<a href='/type/Vector%20t'>Vector</a><<a href='/type/TopPeerCategoryPeers'>TopPeerCategoryPeers</a>> chats:<a href='/type/Vector%20t'>Vector</a><<a href='/type/Chat'>Chat</a>> users:<a href='/type/Vector%20t'>Vector</a><<a href='/type/User'>User</a>> = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
|
||
<a href='/constructor/contacts.topPeersDisabled'>contacts.topPeersDisabled</a>#b52c939d = <a href='/type/contacts.TopPeers'>contacts.TopPeers</a>;
|
||
|
||
---functions---
|
||
|
||
<a href='/method/contacts.toggleTopPeers'>contacts.toggleTopPeers</a>#8514bdda enabled:<a href='/type/Bool'>Bool</a> = <a href='/type/Bool'>Bool</a>;
|
||
<a href='/method/contacts.getTopPeers'>contacts.getTopPeers</a>#973478b6 flags:<a href='/type/%23'>#</a> correspondents:flags.0?<a href='/constructor/true'>true</a> bots_pm:flags.1?<a href='/constructor/true'>true</a> bots_inline:flags.2?<a href='/constructor/true'>true</a> phone_calls:flags.3?<a href='/constructor/true'>true</a> forward_users:flags.4?<a href='/constructor/true'>true</a> forward_chats:flags.5?<a href='/constructor/true'>true</a> groups:flags.10?<a href='/constructor/true'>true</a> channels:flags.15?<a href='/constructor/true'>true</a> bots_app:flags.16?<a href='/constructor/true'>true</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/contacts.TopPeers'>contacts.TopPeers</a>;
|
||
<a href='/method/contacts.resetTopPeerRating'>contacts.resetTopPeerRating</a>#1ae373ac category:<a href='/type/TopPeerCategory'>TopPeerCategory</a> peer:<a href='/type/InputPeer'>InputPeer</a> = <a href='/type/Bool'>Bool</a>;</code></pre>
|
||
<p>The rate delta is computed by taking the time delta between the last time the user used a certain peer and the last time the rating for that peer was received through <a href="/method/contacts.getTopPeers">contacts.getTopPeers</a> and dividing it by the <a href="/constructor/config">exponential decay from config</a>.</p>
|
||
<p>Specifically, clients should:</p>
|
||
<ol>
|
||
<li>On startup, invoke <a href="/method/contacts.getTopPeers">contacts.getTopPeers</a> for all the required peer rate categories, fetching and storing the ratings for all top peers in a local database. </li>
|
||
<li>Every time a user opens (for example) chat <code>123456789</code> the following operation must be done on the cached top peer info.<br>
|
||
<br>
|
||
<code>dateOpened</code> indicates when was the peer used.<br>
|
||
<code>normalizeRate</code> is an arbitrary time in the recent past (when ratings are received from the server using <a href="/method/contacts.getTopPeers">contacts.getTopPeers</a> and the schema described above, it is the time when they were received).<br>
|
||
<code>config.rating_e_decay</code> is the <a href="/constructor/config">exponential decay from config</a>. </li>
|
||
</ol>
|
||
<pre><code> topPeer.rating += e^((dateOpened - normalizeRate) / config.rating_e_decay)</code></pre>
|
||
<ol start="3">
|
||
<li>Every time the client needs to display a list of commonly used bots, users, mini apps, call destinations, etc (for example for the <a href="/api/search#global-search">global search tab</a>), sort the peers by the <code>rating</code> for the specified category. </li>
|
||
</ol>
|
||
<p>Use <a href="/method/contacts.toggleTopPeers">contacts.toggleTopPeers</a> to enable or disable top peer ratings.<br>
|
||
Use <a href="/method/contacts.resetTopPeerRating">contacts.resetTopPeerRating</a> to reset the top peer rating of a certain peer, in a certain category.</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>backToTopInit("Go up");
|
||
removePreloadInit();
|
||
</script>
|
||
</body>
|
||
</html>
|
||
|