2022-02-23 06:45:45 +01:00
<!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)." >
2022-04-21 15:52:36 +02:00
< 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" / >
2022-02-23 06:45:45 +01:00
< 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-02-23 06:45:45 +01: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/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/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/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/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.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 > 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 > ;< / 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 and dividing it by the < a href = "/constructor/config" > exponential decay from config< / a > .< / p >
< p > Example:
Client-side, every time a user opens chat < code > 123456789< / code > the following operation must be done on the cached top peer info.< / p >
< ul >
< li > < code > dateOpened< / code > indicates when was the peer used< / li >
< li > < 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.< / li >
< / ul >
< pre > < code > topPeer.rating += e^((dateOpened - normalizeRate) / config.rating_e_decay)< / code > < / pre > < / 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 >
2022-09-09 12:10:24 +02:00
< li > < a href = "//telegram.org/privacy" > Privacy< / a > < / li >
2022-02-23 06:45:45 +01:00
< / 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 >
2022-04-19 13:17:31 +02:00
< script src = "/js/main.js?46" > < / script >
2022-02-23 06:45:45 +01:00
< script > b a c k T o T o p I n i t ( " G o u p " ) ;
removePreloadInit();
< / script >
< / body >
< / html >