mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-29 07:52:37 +01:00
Update content of files
This commit is contained in:
parent
0b1f3da199
commit
542d4fa03c
14 changed files with 4951 additions and 2227 deletions
215
data/corefork.telegram.org/api/end-to-end/video-calls.html
Normal file
215
data/corefork.telegram.org/api/end-to-end/video-calls.html
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>End-to-End Encrypted Voice and Video Calls</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="This article describes the end-to-end encryption used for Telegram voice and video calls.
|
||||||
|
Related Articles
|
||||||
|
End-to-End Encryption…">
|
||||||
|
<meta property="og:title" content="End-to-End Encrypted Voice and Video Calls">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="This article describes the end-to-end encryption used for Telegram voice and video calls.
|
||||||
|
Related Articles
|
||||||
|
End-to-End Encryption…">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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/end-to-end%2Fvideo-calls" >End-to-End Encrypted Voice and Video Calls</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">End-to-End Encrypted Voice and Video Calls</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>This article describes the end-to-end encryption used for Telegram <strong>voice</strong> and <strong>video calls</strong>.</p>
|
||||||
|
<h5><a class="anchor" href="#related-articles" id="related-articles" name="related-articles"><i class="anchor-icon"></i></a>Related Articles</h5>
|
||||||
|
<p><div class="dev_page_nav_wrap"></p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/api/end-to-end">End-to-End Encryption in Secret Chats</a></li>
|
||||||
|
<li><a href="/mtproto/security_guidelines">Security Guidelines for Client Developers</a>
|
||||||
|
</div></li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<h2><a class="anchor" href="#establishing-calls" id="establishing-calls" name="establishing-calls"><i class="anchor-icon"></i></a>Establishing Calls</h2>
|
||||||
|
<p>Before a call is ready, some preliminary actions have to be performed. The calling party needs to contact the party to be called and check whether it is ready to accept the call. Besides that, the parties have to negotiate the protocols to be used, learn the IP addresses of each other or of the Telegram relay servers to be used (so-called <em>reflectors</em>), and generate a one-time encryption key for this voice call with the aid of <em>Diffie--Hellman key exchange</em>. All of this is accomplished in parallel with the aid of several Telegram API methods and related notifications. This document covers details related to key generation, encryption and security.</p>
|
||||||
|
<h2><a class="anchor" href="#key-generation" id="key-generation" name="key-generation"><i class="anchor-icon"></i></a>Key Generation</h2>
|
||||||
|
<p>The Diffie-Hellman key exchange, as well as the whole protocol used to create a new voice call, is quite similar to the one used for <a href="/api/end-to-end#key-generation">Secret Chats</a>. We recommend studying the linked article before proceeding.</p>
|
||||||
|
<p>However, we have introduced some important changes to facilitate the <a href="#key-verification">key verification process</a>. Below is the entire exchange between the two communicating parties, the Caller (A) and the Callee (B), through the Telegram servers (S).</p>
|
||||||
|
<ul>
|
||||||
|
<li><em>A</em> executes <a href="/method/messages.getDhConfig">messages.getDhConfig</a> to find out the 2048-bit Diffie-Hellman prime <em>p</em> and generator <em>g</em>. The client is expected to check whether <em>p</em> is a safe prime and perform all the <a href="/api/end-to-end#sending-a-request">security checks</a> necessary for secret chats.</li>
|
||||||
|
<li><em>A</em> chooses a random value of <em>a</em>, 1 < a < p-1, and computes <em>g_a:=power(g,a) mod p</em> (a 256-byte number) and <em>g_a_hash:=SHA256(g_a)</em> (32 bytes long).</li>
|
||||||
|
<li><em>A</em> invokes (sends to server <em>S</em>) <a href="/method/phone.requestCall">phone.requestCall</a>, which has the field <code>g_a_hash:bytes</code>, among others. For this call, this field is to be filled with <em>g_a_hash</em>, <strong>not</strong> <em>g_a</em> itself.</li>
|
||||||
|
<li>The Server <em>S</em> performs privacy checks and sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with a <a href="/constructor/phoneCallRequested">phoneCallRequested</a> constructor to all of <em>B</em>'s active devices. This update, apart from the identity of <em>A</em> and other relevant parameters, contains the <em>g_a_hash</em> field, filled with the value obtained from <em>A</em>.</li>
|
||||||
|
<li><em>B</em> accepts the call on one of their devices, stores the received value of <em>g_a_hash</em> for this instance of the voice call creation protocol, chooses a random value of <em>b</em>, 1 < b < p-1, computes <em>g_b:=power(g,b) mod p</em>, performs all the required security checks, and invokes the <a href="/method/phone.acceptCall">phone.acceptCall</a> method, which has a <em>g_b:bytes</em> field (among others), to be filled with the value of <em>g_b</em> itself (not its hash).</li>
|
||||||
|
<li>The Server <em>S</em> sends an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> with the <a href="/constructor/phoneCallDiscarded">phoneCallDiscarded</a> constructor to all other devices <em>B</em> has authorized, to prevent accepting the same call on any of the other devices. From this point on, the server <em>S</em> works only with that of <em>B</em>'s devices which has invoked <a href="/method/phone.acceptCall">phone.acceptCall</a> first.</li>
|
||||||
|
<li>The Server <em>S</em> sends to <em>A</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with <a href="/constructor/phoneCallAccepted">phoneCallAccepted</a> constructor, containing the value of <em>g_b</em> received from <em>B</em>.</li>
|
||||||
|
<li><em>A</em> performs all the usual security checks on <em>g_b</em> and <em>a</em>, computes the Diffie--Hellman key <em>key:=power(g_b,a) mod p</em> and its fingerprint <em>key_fingerprint:long</em>, equal to the lower 64 bits of <em>SHA1(key)</em>, the same as with secret chats. Then <em>A</em> invokes the <a href="/method/phone.confirmCall">phone.confirmCall</a> method, containing <code>g_a:bytes</code> and <code>key_fingerprint:long</code>.</li>
|
||||||
|
<li>The Server <em>S</em> sends to <em>B</em> an <a href="/constructor/updatePhoneCall">updatePhoneCall</a> update with the <a href="/constructor/phoneCall">phoneCall</a> constructor, containing the value of <em>g_a</em> in <em>g_a_or_b:bytes</em> field, and <em>key_fingerprint:long</em></li>
|
||||||
|
<li>At this point <em>B</em> receives the value of <em>g_a</em>. It checks that <em>SHA256(g_a)</em> is indeed equal to the previously received value of <em>g_a_hash</em>, performs all the <a href="/mtproto/security_guidelines">usual Diffie-Hellman security checks</a>, and computes the key <em>key:=power(g_a,b) mod p</em> and its fingerprint, equal to the lower 64 bits of <em>SHA1(key)</em>. Then it checks that this fingerprint equals the value of <code>key_fingerprint:long</code> received from the other side, as an implementation sanity check.</li>
|
||||||
|
</ul>
|
||||||
|
<p>At this point, the Diffie--Hellman key exchange is complete, and both parties have a 256-byte shared secret key <em>key</em> which is used to encrypt all further exchanges between <em>A</em> and <em>B</em>.</p>
|
||||||
|
<p>It is of paramount importance to accept each update only once for each instance of the key generation protocol, discarding any duplicates or alternative versions of already received and processed messages (updates).</p>
|
||||||
|
<h2><a class="anchor" href="#encryption" id="encryption" name="encryption"><i class="anchor-icon"></i></a>Encryption</h2>
|
||||||
|
<blockquote>
|
||||||
|
<p>This document describes encryption in <strong>voice and video calls</strong> as implemented in Telegram apps with versions <strong>7.0</strong> and above. See <a href="https://core.telegram.org/api/end-to-end/voice-calls">this document</a> for details on encryption used in <strong>voice calls</strong> in app versions released before <strong>August 14, 2020</strong>.</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>The <a href="https://github.com/TelegramMessenger/tgcalls">Telegram Voice and Video Call Library</a> uses an optimized version of <a href="/">MTProto 2.0</a> to send and receive <strong>packets</strong>, consisting of one or more end-to-end encrypted <strong>messages</strong> of various types (<a href="https://webrtcglossary.com/ice/"><em>ice</em></a> <em>candidates list, video formats, remote video status, audio stream data, video stream data, message ack</em> or <em>empty</em>).</p>
|
||||||
|
<p>This document describes only the encryption process, leaving out encoding and network-dependent parts.</p>
|
||||||
|
<p>The library starts working with:</p>
|
||||||
|
<ul>
|
||||||
|
<li>An <a href="#encryption-key">encryption key</a> <code>key</code> shared between the parties, as generated above.</li>
|
||||||
|
<li>Information whether the call is <strong>outgoing</strong> or <strong>incoming</strong>.</li>
|
||||||
|
<li>Two data transfer channels: <strong>signaling</strong>, offered by the Telegram API, and <strong>transport</strong> based on WebRTC.</li>
|
||||||
|
</ul>
|
||||||
|
<p>Both data transfer channels are unreliable (messages may get lost), but <strong>signaling</strong> is slower and more reliable.</p>
|
||||||
|
<h3><a class="anchor" href="#encrypting-call-data" id="encrypting-call-data" name="encrypting-call-data"><i class="anchor-icon"></i></a>Encrypting Call Data</h3>
|
||||||
|
<p>The body of a packet (<code>decrypted_body</code>) consists of several messages and their respective <code>seq</code> numbers concatenated together.</p>
|
||||||
|
<ul>
|
||||||
|
<li>decrypted_body = message_seq1 + message_body1 + message_seq2 + message_body2</li>
|
||||||
|
</ul>
|
||||||
|
<p>Each <code>decrypted_body</code> is unique because no two <code>seq</code> numbers of the first message can be the same. If only old messages need to be re-sent, an <em>empty</em> message with new unique <code>seq</code> is added to the packet first.</p>
|
||||||
|
<p>The <a href="#key-generation">encryption key</a> <code>key</code> is used to compute a 128-bit <code>msg_key</code> and then a 256-bit <code>aes_key</code> and a 128-bit <code>aes_iv</code>:</p>
|
||||||
|
<ul>
|
||||||
|
<li>msg_key_large = SHA256 (substr(key, 88+x, 32) + decrypted_body);</li>
|
||||||
|
<li>msg_key = substr (msg_key_large, 8, 16);</li>
|
||||||
|
<li>sha256_a = SHA256 (msg_key + substr (key, x, 36));</li>
|
||||||
|
<li>sha256_b = SHA256 (substr (key, 40+x, 36) + msg_key);</li>
|
||||||
|
<li>aes_key = substr (sha256_a, 0, 8) + substr (sha256_b, 8, 16) + substr (sha256_a, 24, 8);</li>
|
||||||
|
<li>aes_iv = substr (sha256_b, 0, 4) + substr (sha256_a, 8, 8) + substr (sha256_b, 24, 4);</li>
|
||||||
|
</ul>
|
||||||
|
<p><code>x</code> depends on whether the call is <strong>outgoing</strong> or <strong>incoming</strong> and on the connection type:</p>
|
||||||
|
<ul>
|
||||||
|
<li>x = 0 for <strong>outgoing</strong> + <strong>transport</strong></li>
|
||||||
|
<li>x = 8 for <strong>incoming</strong> + <strong>transport</strong></li>
|
||||||
|
<li>x = 128 for <strong>outgoing</strong> + <strong>signaling</strong></li>
|
||||||
|
<li>x = 136 for <strong>incoming</strong> + <strong>signaling</strong></li>
|
||||||
|
</ul>
|
||||||
|
<p>This allows apps to decide which packet types will be sent to which connections and work in these connections independently (with each having its own <code>seq</code> counter).</p>
|
||||||
|
<p>The resulting <code>aes_key</code> and <code>aes_iv</code> are used to encrypt <code>decrypted_body</code>:</p>
|
||||||
|
<ul>
|
||||||
|
<li>encrypted_body = AES_CTR (decrypted_body, aes_key, aes_iv)</li>
|
||||||
|
</ul>
|
||||||
|
<p>The packet that gets sent consists of <code>msg_key</code> and <code>encrypted_body</code>:</p>
|
||||||
|
<ul>
|
||||||
|
<li>packet_bytes = msg_key + encrypted_body</li>
|
||||||
|
</ul>
|
||||||
|
<p>When received, the packet gets decrypted using <code>key</code> and <code>msg_key</code>, after which <code>msg_key</code> is checked against the relevant <code>SHA256</code> substring. If the check fails, the packet <strong>must</strong> be discarded.</p>
|
||||||
|
<h3><a class="anchor" href="#protecting-against-replay-attacks" id="protecting-against-replay-attacks" name="protecting-against-replay-attacks"><i class="anchor-icon"></i></a>Protecting Against Replay Attacks</h3>
|
||||||
|
<p>Each of the peers maintains its own 32-bit monotonically increasing counter for outgoing messages, <code>seq</code>, starting with <code>1</code>. This <code>seq</code> counter is prepended to each sent message and increased by <code>1</code> for each new message. No two <code>seq</code> numbers of the first message in a packet can be the same. If only old messages need to be re-sent, an <em>empty</em> message with a new unique <code>seq</code> is added to the packet first. When the <code>seq</code> counter reaches <code>2^30</code>, the call must be aborted. Each peer stores <code>seq</code> values of all the messages it has received (and processed) which are larger than <code>max_received_seq - 64</code>, where <code>max_received_seq</code> is the largest <code>seq</code> number received so far.</p>
|
||||||
|
<p>If a packet is received, the first message of which has a <code>seq</code> that is smaller or equal to <code>max_received_seq - 64</code> or its <code>seq</code> had already been received, the message is discarded. Otherwise, the <code>seq</code> values of all incoming messages are memorized and <code>max_received_seq</code> is adjusted. This guarantees that no two packets will be processed twice.</p>
|
||||||
|
<h2><a class="anchor" href="#key-verification" id="key-verification" name="key-verification"><i class="anchor-icon"></i></a>Key Verification</h2>
|
||||||
|
<p>To verify the key, and ensure that no MITM attack is taking place, both parties concatenate the secret key <em>key</em> with the value <em>g_a</em> of the Caller ( <em>A</em> ), compute SHA256 and use it to generate a sequence of emoticons. More precisely, the SHA256 hash is split into four 64-bit integers; each of them is divided by the total number of emoticons used (currently 333), and the remainder is used to select specific emoticons. The specifics of the protocol guarantee that comparing four emoticons out of a set of 333 is sufficient to prevent eavesdropping (MiTM attack on DH) with a probability of <strong>0.9999999999</strong>.</p>
|
||||||
|
<p>This is because instead of the standard Diffie-Hellman key exchange which requires only two messages between the parties:</p>
|
||||||
|
<ul>
|
||||||
|
<li>A->B : (generates a and) sends g_a := g^a</li>
|
||||||
|
<li>B->A : (generates b and true key (g_a)^b, then) sends g_b := g^b</li>
|
||||||
|
<li>A : computes key (g_b)^a</li>
|
||||||
|
</ul>
|
||||||
|
<p>we use a <strong>three-message modification</strong> thereof that works well when both parties are online (which also happens to be a requirement for voice calls):</p>
|
||||||
|
<ul>
|
||||||
|
<li>A->B : (generates a and) sends g_a_hash := hash(g^a)</li>
|
||||||
|
<li>B->A : (stores g_a_hash, generates b and) sends g_b := g^b</li>
|
||||||
|
<li>A->B : (computes key (g_b)^a, then) sends g_a := g^a</li>
|
||||||
|
<li>B : checks hash(g_a) == g_a_hash, then computes key (g_a)^b</li>
|
||||||
|
</ul>
|
||||||
|
<p>The idea here is that <em>A</em> commits to a specific value of <em>a</em> (and of <em>g_a</em>) without disclosing it to <em>B</em>. <em>B</em> has to choose its value of <em>b</em> and <em>g_b</em> without knowing the true value of <em>g_a</em>, so that it cannot try different values of <em>b</em> to force the final key <em>(g_a)^b</em> to have any specific properties (such as fixed lower 32 bits of SHA256(key)). At this point, <em>B</em> commits to a specific value of <em>g_b</em> without knowing <em>g_a</em>. Then <em>A</em> has to send its value <em>g_a</em>; it cannot change it even though it knows <em>g_b</em> now, because the other party <em>B</em> would accept only a value of <em>g_a</em> that has a hash specified in the very first message of the exchange.</p>
|
||||||
|
<p>If some impostor is pretending to be either <em>A</em> or <em>B</em> and tries to perform a Man-in-the-Middle Attack on this Diffie--Hellman key exchange, the above still holds. Party <em>A</em> will generate a shared key with <em>B</em> -- or whoever pretends to be <em>B</em> -- without having a second chance to change its exponent <em>a</em> depending on the value <em>g_b</em> received from the other side; and the impostor will not have a chance to adapt his value of <em>b</em> depending on <em>g_a</em>, because it has to commit to a value of <em>g_b</em> before learning <em>g_a</em>. The same is valid for the key generation between the impostor and the party <em>B</em>.</p>
|
||||||
|
<p>The use of hash commitment in the DH exchange constrains the attacker to only <strong>one guess</strong> to generate the correct visualization in their attack, which means that using just over 33 bits of entropy represented by four emoji in the visualization is enough to make a successful attack highly improbable.</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>For a slightly more user-friendly explanation of the above see: <a href="https://core.telegram.org/techfaq#q-how-are-voice-calls-authenticated">How are calls authenticated?</a></p>
|
||||||
|
</blockquote></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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
181
data/corefork.telegram.org/bots/inline.html
Normal file
181
data/corefork.telegram.org/bots/inline.html
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Inline Bots</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
|
||||||
|
<meta property="og:title" content="Inline Bots">
|
||||||
|
<meta property="og:image" content="https://corefork.telegram.org/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305">
|
||||||
|
<meta property="og:description" content="Inline bots: A new way to interact with bots and send bot-generated content to any chat, group or channel.">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><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="/bots" >Telegram Bots</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/bots/inline" >Inline Bots</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">Inline Bots</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><!-- scroll_nav -->
|
||||||
|
|
||||||
|
<div class="dev_side_image">
|
||||||
|
<a href="/file/811140221/1/fW9vnLya4Fg/e2b5c530c7b0e019c4" target="_blank"><img src="/file/811140530/1/h-eMmPp2vp4/cd4a109f75e6561305" title="Inline bots. Click for hi-res picture">
|
||||||
|
</a></div>
|
||||||
|
<p>Beyond sending commands in private messages or groups, users can interact with your bot via <a href="/bots/api#inline-mode"><strong>inline queries</strong></a>. If inline queries are enabled, users can call your bot by typing its username and a query in the <strong>text input field</strong> in <strong>any</strong> chat. The query is sent to your bot in an update. This way, people can request content from your bot in <strong>any</strong> of their chats, groups, or channels without sending any messages at all.</p>
|
||||||
|
<div><center>
|
||||||
|
<a href="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" target="_blank"><img src="/file/811140995/1/I-wubuXAnzk/2e39739d0ac6bd5458" title="Users can type the bot’s username in any chat, then type a query without sending any messages" style="width:300px; padding:10px 0px 10px"></a></center>
|
||||||
|
<br></div>
|
||||||
|
<p>To enable this option, send the <code>/setinline</code> command to <a href="https://telegram.me/botfather">@BotFather</a> and provide the placeholder text that the user will see in the input field after typing your bot’s name.</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>See the <a href="/bots/api#inline-mode">Bot API Manual</a> for the relevant methods and objects.</p>
|
||||||
|
</blockquote>
|
||||||
|
<h3><a class="anchor" href="#inline-results" id="inline-results" name="inline-results"><i class="anchor-icon"></i></a>Inline results</h3>
|
||||||
|
<p>Inline bots support <strong>all types of content</strong> available in Telegram (20 in all). They are capable of sending stickers, videos, music, locations, documents and more. </p>
|
||||||
|
<div><center>
|
||||||
|
<a href="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" target="_blank"><img src="/file/811140994/2/fvw-q_CRaBQ/c618325e119b0a8229" title="All kinds of inline content" style="width: 295px; padding: 10px 20px;"></a></center><br>
|
||||||
|
</div>
|
||||||
|
<p>Clients can display the results with vertical or horizontal scrolling, depending on the type of content:</p>
|
||||||
|
<div><center>
|
||||||
|
<pre><code><a href="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" target="_blank"><img src="/file/811140049/2/M2mzqjZoiUw/2d872f0df2aed182d6" title="Vertical scrolling" style="width: 295px; padding: 0px 20px;" /></a></code></pre>
|
||||||
|
<p><a href="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" target="_blank"><img src="/file/811140592/2/P4-tFhmBsCg/57418af08f1a252d45" title="Horizontal scrolling" style="width: 295px; padding: 0px 20px;"></a></p>
|
||||||
|
</center>
|
||||||
|
<br></div>
|
||||||
|
<p>As soon as the user taps on an item, it's immediately sent to the recipient, and the input field is cleared.</p>
|
||||||
|
<h3><a class="anchor" href="#switching-inlinepm-modes" id="switching-inlinepm-modes" name="switching-inlinepm-modes"><i class="anchor-icon"></i></a>Switching inline/PM modes</h3>
|
||||||
|
<p>Some inline bots can benefit from an initial setup process, like connecting them to an account on an external service (e.g., YouTube). We've added an easy way of switching between the private chat with a bot and whatever chat the user wants to share inline results in.</p>
|
||||||
|
<div><center>
|
||||||
|
<a href="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" target="_blank"><img src="/file/811140951/1/FD93gAgDVDI/8d8bdd16e6a7b40c12" title="Switch to PM button" style="width: 295px; padding: 10px 20px;"></a></center><br>
|
||||||
|
</div>
|
||||||
|
<p>You can display a special 'Switch to PM' button above the inline results (or instead of them). This button will open a private chat with the bot and pass a parameter of your choosing, so that you can prompt the user for the relevant setup actions. Once done, you can use an inline keyboard with a <a href="/bots/api#inlinekeyboardmarkup"><em>switch_inline_query</em></a> button to send the user back to the original chat. </p>
|
||||||
|
<p><strong>Sample bots</strong>
|
||||||
|
<a href="https://telegram.me/youtube">@youtube</a> – Shows a 'Sign in to YouTube' button, then suggests personalized results.</p>
|
||||||
|
<blockquote>
|
||||||
|
<p><a href="/bots/api#answerinlinequery">Manual: Switch to PM</a></p>
|
||||||
|
</blockquote>
|
||||||
|
<h3><a class="anchor" href="#location-based-results" id="location-based-results" name="location-based-results"><i class="anchor-icon"></i></a>Location-based results</h3>
|
||||||
|
<p>Inline bots can request location data from their users. Use the <code>/setinlinegeo</code> command with <a href="https://telegram.me/botfather">@BotFather</a> to enable this. Your bot will ask the user for permission to access their location whenever they send an inline request.</p>
|
||||||
|
<p><strong>Sample bot</strong>
|
||||||
|
<a href="https://telegram.me/foursquare">@foursquare</a> – This bot will ask for permission to access the user's location, then provide geo-targeted results.</p>
|
||||||
|
<h3><a class="anchor" href="#spreading-virally" id="spreading-virally" name="spreading-virally"><i class="anchor-icon"></i></a>Spreading virally</h3>
|
||||||
|
<p>Messages sent with the help of your bot will show its username next to the sender's name.</p>
|
||||||
|
<div><center>
|
||||||
|
<pre><code><a href="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" target="_blank"><img src="/file/811140680/2/P3E5RVFzGZ8/5ae6f9c9610b0cbace" title="Gif shared via a bot" style="width: 295px; padding: 0px 20px;" /></a></code></pre>
|
||||||
|
<p><a href="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" target="_blank"><img src="/file/811140016/2/2b_B7nq9OQA/161b06d38843930fe5" title="Inline bot suggestions" style="width: 295px; padding: 0px 20px;"></a></p>
|
||||||
|
<p><br><br></p></center></div>
|
||||||
|
<p>When a user taps on the bot username in the message header, the mention is automatically inserted into the input field. Entering the <code>@</code> symbol in the input field brings up a list of suggestions, featuring recently used inline bots.</p>
|
||||||
|
<h4><a class="anchor" href="#collecting-feedback" id="collecting-feedback" name="collecting-feedback"><i class="anchor-icon"></i></a>Collecting feedback</h4>
|
||||||
|
<p>To know which of the provided results your users are sending to their chat partners, send <a href="https://telegram.me/botfather">@Botfather</a> the <code>/setinlinefeedback</code> command. With this enabled, you will receive updates on the results chosen by your users.</p>
|
||||||
|
<p>Please note that this can create load issues for popular bots – you may receive more results than actual requests due to caching (see the <em>cache_time</em> parameter in <a href="/bots/api#answerinlinequery">answerInlineQuery</a>). For these cases, we recommend adjusting the probability setting to receive 1/10, 1/100 or 1/1000 of the results.</p>
|
||||||
|
<h3><a class="anchor" href="#inline-bot-samples" id="inline-bot-samples" name="inline-bot-samples"><i class="anchor-icon"></i></a>Inline bot samples</h3>
|
||||||
|
<p>Here are some sample inline bots, in case you’re curious to see one in action. Try any of these:
|
||||||
|
<a href="https://telegram.me/gif">@gif</a> – GIF search
|
||||||
|
<a href="https://telegram.me/vid">@vid</a> – Video search
|
||||||
|
<a href="https://telegram.me/pic">@pic</a> – Yandex image search
|
||||||
|
<a href="https://telegram.me/bing">@bing</a> – Bing image search
|
||||||
|
<a href="https://telegram.me/wiki">@wiki</a> – Wikipedia search
|
||||||
|
<a href="https://telegram.me/imdb">@imdb</a> – IMDB search
|
||||||
|
<a href="https://telegram.me/bold">@bold</a> – Make bold, italic or fixed sys text</p>
|
||||||
|
<p><strong>NEW</strong>
|
||||||
|
<a href="https://telegram.me/youtube">@youtube</a> - Connect your account for personalized results
|
||||||
|
<a href="https://telegram.me/music">@music</a> - Search and send classical music
|
||||||
|
<a href="https://telegram.me/foursquare">@foursquare</a> – Find and send venue addresses
|
||||||
|
<a href="https://telegram.me/sticker">@sticker</a> – Find and send stickers based on emoji</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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></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>
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>decryptedMessageActionFlushHistory</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="The entire message history has been deleted.">
|
||||||
|
<meta property="og:title" content="decryptedMessageActionFlushHistory">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="The entire message history has been deleted.">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><a href="/api">API</a></li>
|
||||||
|
<li class=""><a href="/mtproto">Protocol</a></li>
|
||||||
|
<li class="active"><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="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/decryptedMessageActionFlushHistory" >decryptedMessageActionFlushHistory</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">decryptedMessageActionFlushHistory</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>The entire message history has been deleted.</p>
|
||||||
|
<p><div class="clearfix">
|
||||||
|
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 137 <b class="caret"></b></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="?layer=1">1 – Base layer</a></li><li><a href="?layer=2">2 – New userpic notifications</a></li><li><a href="?layer=3">3 – Send message can trigger link change</a></li><li><a href="?layer=4">4 – Check-in chats</a></li><li><a href="?layer=5">5 – Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 – Foursquare integration</a></li><li><a href="?layer=7">7 – Added wallPaperSolid</a></li><li><a href="?layer=8">8 – Added end-to-end encryption</a></li><li><a href="?layer=9">9 – Improved big files upload perfomance</a></li><li><a href="?layer=10">10 – Improved chat participants updates</a></li><li><a href="?layer=11">11 – Improved secret chats</a></li><li><a href="?layer=12">12 – New dynamic support</a></li><li><a href="?layer=13">13 – Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 – Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 – Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 – Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 – Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 – Added usernames</a></li><li><a href="?layer=23">23 – Stickers for secret chats</a></li><li><a href="?layer=105">105 – Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 – Login with QR code</a></li><li><a href="?layer=109">109 – Polls v2</a></li><li><a href="?layer=110">110 – People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 – Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 – Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 – PSA</a></li><li><a href="?layer=114">114 – Video thumbs for GIFs</a></li><li><a href="?layer=115">115 – Peek Channel Invite</a></li><li><a href="?layer=116">116 – Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 – WebRTC Phone Calls</a></li><li><a href="?layer=118">118 – Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 – Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 – Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 – SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 – Voice Chats</a></li><li><a href="?layer=123">123 – Voice Chat improvements</a></li><li><a href="?layer=124">124 – Expiring Invite links</a></li><li><a href="?layer=125">125 – Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 – Ban channels in channels</a></li><li><a href="?layer=127">127 – Payments in channels</a></li><li><a href="?layer=128">128 – Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 – Video Chats</a></li><li><a href="?layer=130">130 – Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 – Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 – Chat themes</a></li><li><a href="?layer=133">133 – 64-bit IDs for User/Chat</a></li><li><a href="?layer=137"><strong>137 – reactions</strong></a></li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a href="/api/layers">More...</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<pre class="page_scheme"><code>===8===
|
||||||
|
<a href="/constructor/decryptedMessageActionFlushHistory" class="current_page_link" >decryptedMessageActionFlushHistory</a>#6719e45c = <a href="/type/DecryptedMessageAction" >DecryptedMessageAction</a>;</code></pre></p>
|
||||||
|
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
|
||||||
|
<p>This constructor does not require any parameters.</p>
|
||||||
|
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
|
||||||
|
<p><a href="/type/DecryptedMessageAction">DecryptedMessageAction</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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>decryptedMessageActionScreenshotMessages</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="A screenshot was taken.">
|
||||||
|
<meta property="og:title" content="decryptedMessageActionScreenshotMessages">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="A screenshot was taken.">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><a href="/api">API</a></li>
|
||||||
|
<li class=""><a href="/mtproto">Protocol</a></li>
|
||||||
|
<li class="active"><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="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/constructor/decryptedMessageActionScreenshotMessages" >decryptedMessageActionScreenshotMessages</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">decryptedMessageActionScreenshotMessages</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>A screenshot was taken.</p>
|
||||||
|
<p><div class="clearfix">
|
||||||
|
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 137 <b class="caret"></b></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="?layer=1">1 – Base layer</a></li><li><a href="?layer=2">2 – New userpic notifications</a></li><li><a href="?layer=3">3 – Send message can trigger link change</a></li><li><a href="?layer=4">4 – Check-in chats</a></li><li><a href="?layer=5">5 – Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 – Foursquare integration</a></li><li><a href="?layer=7">7 – Added wallPaperSolid</a></li><li><a href="?layer=8">8 – Added end-to-end encryption</a></li><li><a href="?layer=9">9 – Improved big files upload perfomance</a></li><li><a href="?layer=10">10 – Improved chat participants updates</a></li><li><a href="?layer=11">11 – Improved secret chats</a></li><li><a href="?layer=12">12 – New dynamic support</a></li><li><a href="?layer=13">13 – Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 – Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 – Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 – Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 – Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 – Added usernames</a></li><li><a href="?layer=23">23 – Stickers for secret chats</a></li><li><a href="?layer=105">105 – Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 – Login with QR code</a></li><li><a href="?layer=109">109 – Polls v2</a></li><li><a href="?layer=110">110 – People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 – Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 – Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 – PSA</a></li><li><a href="?layer=114">114 – Video thumbs for GIFs</a></li><li><a href="?layer=115">115 – Peek Channel Invite</a></li><li><a href="?layer=116">116 – Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 – WebRTC Phone Calls</a></li><li><a href="?layer=118">118 – Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 – Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 – Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 – SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 – Voice Chats</a></li><li><a href="?layer=123">123 – Voice Chat improvements</a></li><li><a href="?layer=124">124 – Expiring Invite links</a></li><li><a href="?layer=125">125 – Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 – Ban channels in channels</a></li><li><a href="?layer=127">127 – Payments in channels</a></li><li><a href="?layer=128">128 – Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 – Video Chats</a></li><li><a href="?layer=130">130 – Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 – Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 – Chat themes</a></li><li><a href="?layer=133">133 – 64-bit IDs for User/Chat</a></li><li><a href="?layer=137"><strong>137 – reactions</strong></a></li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a href="/api/layers">More...</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<pre class="page_scheme"><code>===8===
|
||||||
|
<a href="/constructor/decryptedMessageActionScreenshotMessages" class="current_page_link" >decryptedMessageActionScreenshotMessages</a>#8ac1f475 random_ids:<a href="/type/Vector%20t" >Vector</a><<a href="/type/long" >long</a>> = <a href="/type/DecryptedMessageAction" >DecryptedMessageAction</a>;</code></pre></p>
|
||||||
|
<h3><a class="anchor" href="#parameters" id="parameters" name="parameters"><i class="anchor-icon"></i></a>Parameters</h3>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th style="text-align: center;">Type</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><strong>random_ids</strong></td>
|
||||||
|
<td style="text-align: center;"><a href="/type/Vector%20t">Vector</a><<a href="/type/long">long</a>></td>
|
||||||
|
<td>List of affected message ids (that appeared on the screenshot)</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h3><a class="anchor" href="#type" id="type" name="type"><i class="anchor-icon"></i></a>Type</h3>
|
||||||
|
<p><a href="/type/DecryptedMessageAction">DecryptedMessageAction</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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
319
data/corefork.telegram.org/mtproto/TL-formal.html
Normal file
319
data/corefork.telegram.org/mtproto/TL-formal.html
Normal file
|
@ -0,0 +1,319 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>TL-formal</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="See also TL Language.
|
||||||
|
For the syntax of declaring combinators, see in article Formal declaration of TL combinators.
|
||||||
|
For…">
|
||||||
|
<meta property="og:title" content="TL-formal">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="See also TL Language.
|
||||||
|
For the syntax of declaring combinators, see in article Formal declaration of TL combinators.
|
||||||
|
For…">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><a href="/api">API</a></li>
|
||||||
|
<li class="active"><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="/mtproto" >Mobile Protocol</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/mtproto/TL-formal" >TL-formal</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">TL-formal</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>See also <a href="TL">TL Language</a>.
|
||||||
|
For the syntax of declaring combinators, see in article <a href="TL-combinators">Formal declaration of TL combinators</a>.
|
||||||
|
For the syntax of patterns, see in article <a href="TL-patterns">Formal declaration of TL patterns</a>. </p>
|
||||||
|
<h3><a class="anchor" href="#tokens" id="tokens" name="tokens"><i class="anchor-icon"></i></a>Tokens</h3>
|
||||||
|
<p>Comments are the same as in C/C++. They are removed by a lexical parser (for example, being replaced by a single space). Whitespace separates tokens. Except for string constants, tokens cannot contain spaces. </p>
|
||||||
|
<p>Character classes: </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>lc-letter</em> ::= <code>a</code> | <code>b</code> | ... | <code>z</code><br>
|
||||||
|
<em>uc-letter</em> ::= <code>A</code> | <code>B</code> | ... | <code>Z</code><br>
|
||||||
|
<em>digit</em> ::= <code>0</code> | <code>1</code> | ... | <code>9</code><br>
|
||||||
|
<em>hex-digit</em> ::= <em>digit</em> | <code>a</code> | <code>b</code> | <code>c</code> | <code>d</code> | <code>e</code> | <code>f</code><br>
|
||||||
|
<em>underscore</em> ::= <code>_</code><br>
|
||||||
|
<em>letter</em> ::= <em>lc-letter</em> | <em>uc-letter</em><br>
|
||||||
|
<em>ident-char</em> ::= <em>letter</em> | <em>digit</em> | <em>underscore</em> </p>
|
||||||
|
</div>
|
||||||
|
<p>Simple identifiers and keywords: </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>lc-ident</em> ::= <em>lc-letter</em> { <em>ident-char</em> }<br>
|
||||||
|
<em>uc-ident</em> ::= <em>uc-letter</em> { <em>ident-char</em> }<br>
|
||||||
|
<em>namespace-ident</em> ::= <em>lc-ident</em><br>
|
||||||
|
<em>lc-ident-ns</em> ::= [ <em>namespace-ident</em> <code>.</code> ] <em>lc-ident</em><br>
|
||||||
|
<em>uc-ident-ns</em> ::= [ <em>namespace-ident</em> <code>.</code> ] <em>uc-ident</em><br>
|
||||||
|
<em>lc-ident-full</em> ::= <em>lc-ident-ns</em> [ <code>#</code> <em>hex-digit</em> *8 ] </p>
|
||||||
|
</div>
|
||||||
|
<p>Tokens:</p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>underscore</em> ::= <code>_</code><br>
|
||||||
|
<em>colon</em> ::= <code>:</code><br>
|
||||||
|
<em>semicolon</em> ::= <code>;</code><br>
|
||||||
|
<em>open-par</em> ::= <code>(</code><br>
|
||||||
|
<em>close-par</em> ::= <code>)</code><br>
|
||||||
|
<em>open-bracket</em> ::= <code>[</code><br>
|
||||||
|
<em>close-bracket</em> ::= <code>]</code><br>
|
||||||
|
<em>open-brace</em> ::= <code>{</code><br>
|
||||||
|
<em>close-brace</em> ::= <code>}</code><br>
|
||||||
|
<em>triple-minus</em> ::= <code>---</code><br>
|
||||||
|
<em>nat-const</em> ::= <em>digit</em> { <em>digit</em> }<br>
|
||||||
|
<em>lc-ident-full</em><br>
|
||||||
|
<em>lc-ident</em><br>
|
||||||
|
<em>uc-ident-ns</em><br>
|
||||||
|
<em>equals</em> ::= <code>=</code><br>
|
||||||
|
<em>hash</em> ::= <code>#</code><br>
|
||||||
|
<em>question-mark</em> ::= <code>?</code><br>
|
||||||
|
<em>percent</em> ::= <code>%</code><br>
|
||||||
|
<em>plus</em> ::= <code>+</code><br>
|
||||||
|
<em>langle</em> ::= <code><</code><br>
|
||||||
|
<em>rangle</em> ::= <code>></code><br>
|
||||||
|
<em>comma</em> ::= <code>,</code><br>
|
||||||
|
<em>dot</em> ::= <code>.</code><br>
|
||||||
|
<em>asterisk</em> ::= <code>*</code><br>
|
||||||
|
<em>excl-mark</em> ::= <code>!</code><br>
|
||||||
|
<em>Final-kw</em> ::= <code>Final</code><br>
|
||||||
|
<em>New-kw</em> ::= <code>New</code><br>
|
||||||
|
<em>Empty-kw</em> ::= <code>Empty</code> </p>
|
||||||
|
</div>
|
||||||
|
<p><code>Final</code> is a reserved keyword, e.g. a special token. Words like <code>Type</code> are not keywords, rather they are identifiers with preset values. </p>
|
||||||
|
<p>Tokens consisting of one or more constant symbols shall be hereafter denoted using terms in quotation marks (for example, <code>---</code> replaces <em>triple-minus</em>). </p>
|
||||||
|
<h2><a class="anchor" href="#syntax" id="syntax" name="syntax"><i class="anchor-icon"></i></a>Syntax</h2>
|
||||||
|
<h3><a class="anchor" href="#general-syntax-of-a-tl-program" id="general-syntax-of-a-tl-program" name="general-syntax-of-a-tl-program"><i class="anchor-icon"></i></a>General syntax of a TL program</h3>
|
||||||
|
<p>Syntactically, a TL program consists of a stream of tokens (separated by spaces, which are ignored at this stage). General program structure: </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>TL-program</em> ::= <em>constr-declarations</em> { <code>---</code> <code>functions</code> <code>---</code> <em>fun-declarations</em> | <code>---</code> <code>types</code> <code>---</code> <em>constr-declarations</em> } </p>
|
||||||
|
</div>
|
||||||
|
<p>Here the constructor- and function declarations are nearly identical in their syntax (they are both combinators): </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>constr-declarations</em> ::= { <em>declaration</em> }<br>
|
||||||
|
<em>fun-declarations</em> ::= { <em>declaration</em> } </p>
|
||||||
|
</div>
|
||||||
|
<p>There are various declarations: </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>declaration</em> ::= <em>combinator-decl</em> | <em>partial-app-decl</em> | <em>final-decl</em> </p>
|
||||||
|
</div>
|
||||||
|
<p>Before explaining how declarations of combinators, partial applications, and type <code>finalization</code> are given, we will introduce additional syntactical categories: </p>
|
||||||
|
<h3><a class="anchor" href="#syntactical-categories-and-constructions" id="syntactical-categories-and-constructions" name="syntactical-categories-and-constructions"><i class="anchor-icon"></i></a>Syntactical categories and constructions</h3>
|
||||||
|
<p>The concept of an expression (<em>expr</em>) is important. There are type expressions (<em>type-expr</em>) and numeric expressions (<em>nat-expr</em>). However, they are defined the same way. Their correctness as type- or numeric expressions is checked when the type of the analyzed expression is checked. </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>type-expr</em> ::= <em>expr</em><br>
|
||||||
|
<em>nat-expr</em> ::= <em>expr</em><br>
|
||||||
|
<em>expr</em> ::= { <em>subexpr</em> }<br>
|
||||||
|
<em>subexpr</em> ::= <em>term</em> | <em>nat-const</em> <code>+</code> <em>subexpr</em> | <em>subexpr</em> <code>+</code> <em>nat-const</em><br>
|
||||||
|
<em>term</em> ::= <code>(</code> <em>expr</em> <code>)</code> | <em>type-ident</em> | <em>var-ident</em> | <em>nat-const</em> | <code>%</code> <em>term</em> | <em>type-ident</em> <code><</code> <em>expr</em> { <code>,</code> <em>expr</em> } <code>></code><br>
|
||||||
|
<em>type-ident</em> ::= <em>boxed-type-ident</em> | <em>lc-ident-ns</em> | <code>#</code><br>
|
||||||
|
<em>boxed-type-ident</em> ::= <em>uc-ident-ns</em><br>
|
||||||
|
<em>var-ident</em> ::= <em>lc-ident</em> | <em>uc-ident</em><br>
|
||||||
|
<em>type-term</em> ::= <em>term</em><br>
|
||||||
|
<em>nat-term</em> ::= <em>term</em> </p>
|
||||||
|
</div>
|
||||||
|
<p>Note that writing <code>E = E_1 E_2 ... E_n</code> in the expression for <em>expr</em> means applying the function <em>E_1</em> to the argument <em>E_2</em>, applying the result to <em>E_3</em>, etc. Specifically, <code>E_1 E_2 E_3 = (E_1 E_2) E_3</code>. A solitary <code>#</code> is included in <em>type-ident</em>, because it is actually the identifier for a built-in type (<code>#</code> alias <code>nat</code>). </p>
|
||||||
|
<p>The expression <code>E<E_1,...,E_n></code> is syntactic sugar for <code>(E (E_1) ... (E_n))</code>, i.e. both expressions are transformed into the same internal representation. </p>
|
||||||
|
<h3><a class="anchor" href="#combinator-declarations" id="combinator-declarations" name="combinator-declarations"><i class="anchor-icon"></i></a>Combinator declarations</h3>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>combinator-decl</em> ::= <em>full-combinator-id</em> { <em>opt-args</em> } { <em>args</em> } <code>=</code> <em>result-type</em> <code>;</code><br>
|
||||||
|
<em>full-combinator-id</em> ::= <em>lc-ident-full</em> | <code>_</code><br>
|
||||||
|
<em>combinator-id</em> ::= <em>lc-ident-ns</em> | <code>_</code><br>
|
||||||
|
<em>opt-args</em> ::= <code>{</code> <em>var-ident</em> { <em>var-ident </em>} : [<em>excl-mark</em>] <em>type-expr</em> <code>}</code><br>
|
||||||
|
<em>args</em> ::= <em>var-ident-opt</em> <code>:</code> [ <em>conditional-def</em> ] [ <code>!</code> ] <em>type-term</em><br>
|
||||||
|
<em>args</em> ::= [ <em>var-ident-opt</em> <code>:</code> ] [ <em>multiplicity</em> <code>*</code>] <code>[</code> { <em>args</em> } <code>]</code><br>
|
||||||
|
<em>args</em> ::= <code>(</code> <em>var-ident-opt</em> { <em>var-ident-opt</em> } <code>:</code> [<code>!</code>] <em>type-term</em> <code>)</code><br>
|
||||||
|
<em>args</em> ::= [ <code>!</code> ] <em>type-term</em><br>
|
||||||
|
<em>multiplicity</em> ::= <em>nat-term</em><br>
|
||||||
|
<em>var-ident-opt</em> ::= <em>var-ident</em> | <code>_</code><br>
|
||||||
|
<em>conditional-def</em> ::= <em>var-ident</em> [ <code>.</code> <em>nat-const</em> ] <code>?</code><br>
|
||||||
|
<em>result-type</em> ::= <em>boxed-type-ident</em> { <em>subexpr</em> }<br>
|
||||||
|
<em>result-type</em> ::= <em>boxed-type-ident</em> <code><</code> <em>subexpr</em> { <code>,</code> <em>subexpr</em> } <code>></code> </p>
|
||||||
|
</div>
|
||||||
|
<p>See <a href="TL-combinators">Formal declaration of TL combinators</a> for a description of what exactly this means. Here we will only note that when declaring the type of a combinator’s next argument, only the names of previously arranged (more to the left) arguments of the same combinator may be used as variables, but when declaring the result type you can use all of its parameters (of type <code>Type</code> and <code>#</code>). </p>
|
||||||
|
<p>Note that the names of combinators declared in this way may be used in TL itself only as the corresponding bare types. The only combinators that appear in declarations are built-in: <code>O : #</code> and <code>S : # -> #</code>. </p>
|
||||||
|
<p>There are also “pseudo-declarations” that are allowed only to declare built-in types (such as <code>int ? = Int;</code>): </p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>builtin-combinator-decl</em> ::= <em>full-combinator-id</em> <code>?</code> <code>=</code> <em>boxed-type-ident</em> <code>;</code> </p>
|
||||||
|
</div>
|
||||||
|
<h3><a class="anchor" href="#partial-applications-patterns" id="partial-applications-patterns" name="partial-applications-patterns"><i class="anchor-icon"></i></a>Partial applications (patterns)</h3>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>partial-app-decl</em> ::= <em>partial-type-app-decl</em> | <em>partial-comb-app-decl</em><br>
|
||||||
|
<em>partial-type-app-decl</em> ::= <em>boxed-type-ident</em> <em>subexpr</em> { <em>subexpr</em> } <code>;</code> | <em>boxed-type-ident</em> <code><</code> <em>expr</em> { <code>,</code> <em>expr</em> } <code>></code> <code>;</code><br>
|
||||||
|
<em>partial-comb-app-decl</em> ::= <em>combinator-id</em> <em>subexpr</em> { <em>subexpr</em> } <code>;</code> </p>
|
||||||
|
</div>
|
||||||
|
<p>See <a href="TL-patterns">Formal declaration of TL patterns</a>. </p>
|
||||||
|
<h3><a class="anchor" href="#type-finalization" id="type-finalization" name="type-finalization"><i class="anchor-icon"></i></a>Type finalization</h3>
|
||||||
|
<div class="richcode">
|
||||||
|
<p><em>final-decl</em> ::= <code>New</code> <em>boxed-type-ident</em> <code>;</code> | <code>Final</code> <em>boxed-type-ident</em> <code>;</code> | <code>Empty</code> <em>boxed-type-ident</em> <code>;</code> </p>
|
||||||
|
</div>
|
||||||
|
<p>This type of declaration means that there must not be any constructor for the indicated type: before the declaration for <code>New</code> and after the declaration for <code>Final</code>. The keyword <code>Empty</code> enables both effects.</p>
|
||||||
|
<h3><a class="anchor" href="#predefined-identifiers" id="predefined-identifiers" name="predefined-identifiers"><i class="anchor-icon"></i></a>Predefined identifiers</h3>
|
||||||
|
<p>Nearly all predefined identifiers may be given using the following schema (usually located in <code>common.tl</code>):</p>
|
||||||
|
<div class="richcode">
|
||||||
|
<p>/////<br>
|
||||||
|
//<br>
|
||||||
|
// Common Types<br>
|
||||||
|
//<br>
|
||||||
|
///// </p>
|
||||||
|
<p>// Built-in types<br>
|
||||||
|
int ? = Int;<br>
|
||||||
|
long ? = Long;<br>
|
||||||
|
double ? = Double;<br>
|
||||||
|
string ? = String; </p>
|
||||||
|
<p>// Boolean emulation<br>
|
||||||
|
boolFalse = Bool;<br>
|
||||||
|
boolTrue = Bool; </p>
|
||||||
|
<p>// Boolean for diagonal queries<br>
|
||||||
|
boolStat statTrue:int statFalse:int statUnknown:int = BoolStat; </p>
|
||||||
|
<p>// Vector<br>
|
||||||
|
vector {t:Type} # [t] = Vector t;<br>
|
||||||
|
tuple {t:Type} {n:#} [t] = Tuple t n;<br>
|
||||||
|
vectorTotal {t:Type} total_count:int vector:%(Vector t) = VectorTotal t; </p>
|
||||||
|
<p>/////<br>
|
||||||
|
//<br>
|
||||||
|
// Result- (Maybe-) types<br>
|
||||||
|
//<br>
|
||||||
|
///// </p>
|
||||||
|
<p>resultFalse {t:Type} = Maybe t;<br>
|
||||||
|
resultTrue {t:Type} result:t = Maybe t; </p>
|
||||||
|
<p>pair {X:Type} {Y:Type} a:X b:Y = Pair X Y;<br>
|
||||||
|
map {X:Type} {Y:Type} key:X value:Y = Map X Y; </p>
|
||||||
|
<p>Empty False;<br>
|
||||||
|
true = True; </p>
|
||||||
|
<p>unit = Unit; </p>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p>Predefined identifier <code>Type</code>: This type signifies the type of all types. It is usually used to specify the types of optional parameters in the constructors of polymorphic types. If strongly desired, it can be used in its own right, but this is very rarely needed in practice.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Identifier <code>#</code>: This type is used to specify a special type of nonnegative integers in the range from 0 to 2^31-1; its main purpose is the same as that of <code>Type</code>. There are two built-in constructors: <code>O</code> : # and <code>S</code> : # -> # (“null” and “next number”, respectively), which work as if <code>#</code> was defined using the schema</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="richcode">
|
||||||
|
<p>O = #;<br>
|
||||||
|
S # = #; </p>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p>Identifier <code>Tuple</code>: Type -> # -> Type denotes a set of the specified number of values of the indicated type. In other words, <em>Tuple X n</em> means “a set of <em>n</em> values of type <em>X</em>".</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>The type<code>Bool</code>, with two constructors <code>boolTrue</code> and <code>boolFalse</code>, is used to transmit Boolean values.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>The constructor-less type <code>False</code> may be used instead of undeclared or invalid types in the construction of a TL schema, because any attempt to (de)serialize a value of type <code>False</code> will produce an error. Usage Example:</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="richcode">
|
||||||
|
<p>user {flags:#} id:flags.0?string first_name:flags.1?string last_name:flags.2?string reserved3:flags.3?False reserved4:flags.4?False = User flags;<br>
|
||||||
|
user_present {flags:#} info:%(User flags) = UserInfo flags;<br>
|
||||||
|
user_absent {flags:#} = UserInfo flags;<br>
|
||||||
|
getUser flags:# id:int = !UserInfo flags; </p>
|
||||||
|
</div>
|
||||||
|
<p>In the future, bits 3 and 4 in the <code>flags</code> field may be used to transmit new fields after changing the names and types of the <code>reserved3</code> and <code>reserved4</code> fields. This will change the <code>user</code> constructor’s number, but this isn’t too important, since the <code>User flags</code> type is only used as a bare type. Transmitting bits 3 or 4 in the <code>flags</code> field in a <code>getUser</code> query before these fields have actually been defined will lead to an error in the (de)serialization of the request.</p>
|
||||||
|
<ul>
|
||||||
|
<li>The type <code>True</code> with a single null constructor <code>true</code> plays a role similar to the void type in C/C++. It is especially useful as a bare type <code>%True</code>, alias <code>true</code>, because its serialization has zero length. For example, the <code>first_name:flags.1?string</code> constructor used above is in fact shorthand for (the as-yet unsupported) alternative-type general constructor <code>first_name:(flags.1?string:true)</code>.</li>
|
||||||
|
</ul>
|
||||||
|
<p>When directly used in a <a href="https://core.telegram.org/mtproto/TL-combinators#conditional-fields">conditional field</a> it may simply indicate the presence (absence) of a certain parameter with void type.
|
||||||
|
If the conditional field exists, the associated parameter will not be populated; the conditional field simply exists and the existance value can be used to perform certain operations, example:</p>
|
||||||
|
<pre><code>user {flags:#} id:flags.0?string first_name:flags.1?string last_name:flags.2?string bot:flags.3?true reserved4:flags.4?False = User flags;</code></pre>
|
||||||
|
<p>If bit 3 of the <code>flags</code> parameter isn't set, the user is a normal user.
|
||||||
|
If bit 3 of the <code>flags</code> parameter is set, this indicates that the specified user is a bot: however, during deserialization, the <code>bot</code> parameter must not be assigned any value, since <code>true</code> is actually a <code>void</code> type.</p>
|
||||||
|
<ul>
|
||||||
|
<li>The type<code>Unit</code> with a single null constructor <code>Unit</code> is similar to the previous type.</li>
|
||||||
|
</ul>
|
||||||
|
<h4><a class="anchor" href="#antlr-definition" id="antlr-definition" name="antlr-definition"><i class="anchor-icon"></i></a>ANTLR definition</h4>
|
||||||
|
<p>An <a href="https://www.antlr.org">ANLTR</a> definition of TL grammar can be found <a href="https://gitlab.com/telekram/telekram/-/blob/master/generator/src/commonMain/antlr/TL.g4">here »</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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
170
data/corefork.telegram.org/mtproto/TL-polymorph.html
Normal file
170
data/corefork.telegram.org/mtproto/TL-polymorph.html
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Polymorphism in TL</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="It should be noted that in the TL schema of the overwhelming majority of API calls the use of polymorphic types is restricted…">
|
||||||
|
<meta property="og:title" content="Polymorphism in TL">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="It should be noted that in the TL schema of the overwhelming majority of API calls the use of polymorphic types is restricted…">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><a href="/api">API</a></li>
|
||||||
|
<li class="active"><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="/mtproto" >Mobile Protocol</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/mtproto/TL" >TL Language</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/mtproto/TL-polymorph" >Polymorphism in TL</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">Polymorphism in TL</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>It should be noted that in the TL schema of the overwhelming majority of API calls the use of polymorphic types is restricted to the Vector type. Nevertheless, having a view of the big picture is still helpful.</p>
|
||||||
|
<h3><a class="anchor" href="#ordinary-inductive-types" id="ordinary-inductive-types" name="ordinary-inductive-types"><i class="anchor-icon"></i></a>Ordinary inductive types</h3>
|
||||||
|
<p>For example, let us consider the IntList, which is defined as follows:</p>
|
||||||
|
<pre><code>int_cons hd:int tl:IntList = IntList;
|
||||||
|
int_nil = IntList;</code></pre>
|
||||||
|
<p>The “int_cons” and “int_nil” constructors as well as the “IntList” type itself are expressions of the following types (writing A : X means that A is an expression of type X):</p>
|
||||||
|
<pre><code>IntList : Type;
|
||||||
|
int_cons : int -> IntList -> IntList;
|
||||||
|
int_nil : IntList;</code></pre>
|
||||||
|
<p>The keyword <em>Type</em> is used to denote the type of all types. Note that Type is not Object (Object is the type of all terms).
|
||||||
|
Here is alternative syntax that could be used in some other functional programming language (but not in TL):</p>
|
||||||
|
<pre><code>NewType IntList :=
|
||||||
|
| int_cons hd:int tl:IntList
|
||||||
|
| int_nil
|
||||||
|
EndType</code></pre>
|
||||||
|
<h3><a class="anchor" href="#polymorphic-type" id="polymorphic-type" name="polymorphic-type"><i class="anchor-icon"></i></a>Polymorphic type</h3>
|
||||||
|
<p>TL supports the following version (curly brackets indicate optional fields, see below):</p>
|
||||||
|
<pre><code>cons {X:Type} hd:X tl:(List X) = List X;
|
||||||
|
nil {X:Type} = List X</code></pre>
|
||||||
|
<p>Here is an alternative formulation in other functional languages with dependent types:</p>
|
||||||
|
<pre><code>NewType List {X:Type} :=
|
||||||
|
| cons {X:Type} hd:X tl:(List X)
|
||||||
|
| nil {X:Type}
|
||||||
|
EndType</code></pre>
|
||||||
|
<p>In any event, these variations are equivalent to one another from the point of view of the formal theory of types and lead to the definition of the following terms:</p>
|
||||||
|
<pre><code>List : Type -> Type;
|
||||||
|
cons : forall (X:Type), X -> List X -> List X;
|
||||||
|
nil : forall (X:Type), X -> List X;</code></pre>
|
||||||
|
<p>In each case, remember that writing “A -> B” is shorthand for “forall (x : A), B” for any variable x not entering into A and B. For example, the “cons” type could be written as follows:</p>
|
||||||
|
<pre><code>cons : forall (X:Type), forall (hd : X), forall (tl : List X), List X</code></pre>
|
||||||
|
<p>or more compactly:</p>
|
||||||
|
<pre><code>cons : forall (X : Type) (hd : X) (tl : List X), List X</code></pre>
|
||||||
|
<p>See <a href="https://en.wikipedia.org/wiki/Calculus_of_constructions">Calculus of constructions</a>. Examples of functional languages with dependent types, which support similar constructions are <a href="https://en.wikipedia.org/wiki/Coq">Coq</a> and <a href="https://en.wikipedia.org/wiki/Agda_%28programming_language%29">Agda</a>.</p>
|
||||||
|
<p>In this case, the entry after a universal quantifier proves to be more content-related than that after an arrow, because the name of a variable bound by the quantifier is used to transmit the name of the corresponding field in the constructor, even if this variable is not used anywhere as it pertains to the expression under the quantifier. Structurally, all of these entries of the “cons” type are equivalent.</p>
|
||||||
|
<h3><a class="anchor" href="#serialization-of-types-values-of-type-type" id="serialization-of-types-values-of-type-type" name="serialization-of-types-values-of-type-type"><i class="anchor-icon"></i></a>Serialization of types (values of type Type)</h3>
|
||||||
|
<p>As we can see, to serialize a value of type List X, which has been obtained by applying the combinator “cons X:Type hd:X tl:(List X) = List X”, we need to:</p>
|
||||||
|
<ol>
|
||||||
|
<li>serialize the name of the “cons” combinator into a 32-bit number;</li>
|
||||||
|
<li>serialize X (as a type, i.e. as a value of type Type) if X is a required parameter;</li>
|
||||||
|
<li>serialize the head of the list (hd) as a value of type X;</li>
|
||||||
|
<li>serialize the tail of the list as a value of the polymorphic type List X. </li>
|
||||||
|
</ol>
|
||||||
|
<p>In the first step, the natural question is which string exactly will be used to calculate the CRC32. It is proposed to take "<code>cons X:Type hd:X tl:List X = List X</code>” without the terminating semicolon and without any parentheses (closed type expressions are unambiguously reconstructed based on their construction’s prefix).</p>
|
||||||
|
<p>In the last step, we recursively resolve the very same problem of serializing a value of type List X; we will consider it resolved based on the assumption of induction in the construction of the value being serialized. We will similarly consider the third step understandable (induction in the construction of the value being serialized). </p>
|
||||||
|
<p>We still need to describe how to transmit (serialize) types, e.g. values of type <strong>Type</strong>. <em>Types in TL schemas currently appear only as constructors’ optional parameters and are therefore never serialized explicitly. Rather, their values are inferred from the previously known type of the value being serialized</em>. </p>
|
||||||
|
<p>For completeness we will describe how it would be possible to serialize types (values of type Type). However, keep in mind that for now this information is not useful. See <a href="/mtproto/TL-types">Type serialization</a>.</p>
|
||||||
|
<h3><a class="anchor" href="#optional-arguments-in-polymorphic-constructors" id="optional-arguments-in-polymorphic-constructors" name="optional-arguments-in-polymorphic-constructors"><i class="anchor-icon"></i></a>Optional arguments in polymorphic constructors</h3>
|
||||||
|
<p>It was stated above that any subset of (the first few) parameters of any constructor can be identified as optional (by enclosing their declarations in curly brackets), but this is not actually entirely accurate. First, these optional parameters can only be of type <code>Type</code> or <code>#</code> (natural numbers). Second, optional parameters must share the return value’s type, otherwise their value cannot be determined.</p>
|
||||||
|
<p>Note that @'''constr-id''' means the constructor’s “full form” (in which all optional parameters become required), while '''constr-id'’ denotes its abbreviated form (without the optional arguments). If there are no optional arguments, then these two forms are the same. Constructors’ full forms are never used at present.</p>
|
||||||
|
<h3><a class="anchor" href="#bare-polymorphic-types" id="bare-polymorphic-types" name="bare-polymorphic-types"><i class="anchor-icon"></i></a>Bare polymorphic types</h3>
|
||||||
|
<p>There is a small problem: if we want to serialize the value of the bare type ‘%pair string int’ or ‘%pair string Y’ (which in TL is usually denoted simply as “pair”, though the form “%Pair” is preferable), we cannot simultaneously use both the full constructor @pair and the partial pair, because the constructor’s name will not be serialized. Therefore, we must differentiate the bare types %@pair (type X, type Y, value x:X, and value y:Y are serialized) and %pair (only x:X and y:Y are serialized; types X and Y are known from the context). In practice, we nearly almost always need the bare type %pair, and this is precisely what “pair” means in the type’s context in TL. Therefore, </p>
|
||||||
|
<pre><code>record name:string map:(List (pair int string)) = Record;</code></pre>
|
||||||
|
<p>will be serialized approximately like we want it to be (the serialization of list elements will consist of the serialization of int and the serialization of string, without any additional headers, types, or combinator names).
|
||||||
|
Incidentally, when calculating the “record” combinator’s name <em>'record'</em> in the example given above, the CRC32 of <code>record name:string map:List pair int string = Record</code> will be computed.</p>
|
||||||
|
<p>Also note that a more precise description of this type would be</p>
|
||||||
|
<pre><code>record name:string map:(List %(Pair int string)) = Record</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>
|
||||||
|
<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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
246
data/corefork.telegram.org/passport/sdk-ios-mac.html
Normal file
246
data/corefork.telegram.org/passport/sdk-ios-mac.html
Normal file
|
@ -0,0 +1,246 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>iOS & macOS SDK</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="TGPassportKit helps you easily integrate Telegram Passport requests into your iOS & macOS apps. Check out our GitHub repository…">
|
||||||
|
<meta property="og:title" content="iOS & macOS SDK">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="TGPassportKit helps you easily integrate Telegram Passport requests into your iOS & macOS apps. Check out our GitHub repository…">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><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="/passport" >Telegram Passport</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/passport/sdk-ios-mac" >iOS & macOS SDK</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">iOS & macOS SDK</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><!-- scroll_nav -->
|
||||||
|
|
||||||
|
<p>TGPassportKit helps you easily integrate Telegram Passport requests into your iOS & macOS apps. Check out our <a href="https://github.com/TelegramMessenger/TGPassportKit">GitHub repository</a> to see samples using this SDK.</p>
|
||||||
|
<h3><a class="anchor" href="#installation" id="installation" name="installation"><i class="anchor-icon"></i></a>Installation</h3>
|
||||||
|
<h4><a class="anchor" href="#installing-using-cocoapods" id="installing-using-cocoapods" name="installing-using-cocoapods"><i class="anchor-icon"></i></a>Installing using Cocoapods</h4>
|
||||||
|
<p>To install TGPassportKit via Cocoapods add the following to your Podfile:</p>
|
||||||
|
<pre><code>target 'MyApp' do
|
||||||
|
pod 'TGPassportKit'
|
||||||
|
end</code></pre>
|
||||||
|
<p>then run <code>pod install</code> in your project root directory.</p>
|
||||||
|
<h4><a class="anchor" href="#installing-using-carthage" id="installing-using-carthage" name="installing-using-carthage"><i class="anchor-icon"></i></a>Installing using Carthage</h4>
|
||||||
|
<p>Add the following line to your Cartfile:</p>
|
||||||
|
<pre><code>github "telegrammessenger/TGPassportKit"</code></pre>
|
||||||
|
<p>then run <code>carthage update</code>, and you will get the latest version of TGPassportKit in your Carthage folder.</p>
|
||||||
|
<h3><a class="anchor" href="#project-setup" id="project-setup" name="project-setup"><i class="anchor-icon"></i></a>Project Setup</h3>
|
||||||
|
<h4><a class="anchor" href="#configure-your-infoplist" id="configure-your-infoplist" name="configure-your-infoplist"><i class="anchor-icon"></i></a>Configure Your Info.plist</h4>
|
||||||
|
<p>Configure your Info.plist by right-clicking it in Project Navigator, choosing <strong>Open As > Source Code</strong> and adding this snippet:
|
||||||
|
<em>Replace <code>{bot_id}</code> with your value</em></p>
|
||||||
|
<pre><code><key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>tgbot{bot_id}</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>tg</string>
|
||||||
|
</array></code></pre>
|
||||||
|
<h4><a class="anchor" href="#connect-appdelegate-methods" id="connect-appdelegate-methods" name="connect-appdelegate-methods"><i class="anchor-icon"></i></a>Connect AppDelegate methods</h4>
|
||||||
|
<p>Add this code to your <code>UIApplicationDelegate</code> implementation</p>
|
||||||
|
<pre><code>#import <TGPassportKit/TGPAppDelegate.h>
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication *)application
|
||||||
|
openURL:(NSURL *)url
|
||||||
|
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
|
||||||
|
BOOL handledByPassportKit = [[TGPAppDelegate sharedDelegate] application:application
|
||||||
|
openURL:url
|
||||||
|
options:options];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}</code></pre>
|
||||||
|
<p>If you support iOS 9 and below, also add this method:</p>
|
||||||
|
<pre><code>- (BOOL)application:(UIApplication *)application
|
||||||
|
openURL:(NSURL *)url
|
||||||
|
sourceApplication:(nullable NSString *)sourceApplication
|
||||||
|
annotation:(id)annotation {
|
||||||
|
BOOL handledByPassportKit = [[TGPAppDelegate sharedDelegate] application:application
|
||||||
|
openURL:url
|
||||||
|
sourceApplication:sourceApplication
|
||||||
|
annotation:annotation];
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}</code></pre>
|
||||||
|
<h3><a class="anchor" href="#usage" id="usage" name="usage"><i class="anchor-icon"></i></a>Usage</h3>
|
||||||
|
<h4><a class="anchor" href="#add-telegram-passport-button" id="add-telegram-passport-button" name="add-telegram-passport-button"><i class="anchor-icon"></i></a>Add Telegram Passport Button</h4>
|
||||||
|
<p>To add the Telegram Passport button, add the following code to your view controller:
|
||||||
|
<em>Replace <code>{bot_id}</code>, <code>{bot_public_key}</code> and <code>{request_nonce}</code> with your values</em></p>
|
||||||
|
<pre><code>#import <TGPassportKit/TGPButton.h>
|
||||||
|
|
||||||
|
@interface ViewController <TGPButtonDelegate>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation ViewController
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
|
||||||
|
TGPButton *button = [[TGPButton alloc] init];
|
||||||
|
button.botConfig = [[TGPBotConfig alloc] initWithBotId:{bot_id}
|
||||||
|
publicKey:@"{bot_public_key}"];
|
||||||
|
button.scope = [[TGPScope alloc] initWithJSONString:@"{\"data\":[\"id_document\",\"address_document\",\"phone_number\"],\"v\":1}"];
|
||||||
|
// You can also construct a scope using provided data type classes like this:
|
||||||
|
// button.scope = [[TGPScope alloc] initWithTypes:@[[[TGPPersonalDetails alloc] init], [[TGPIdentityDocument alloc] initWithType:TGPIdentityDocumentTypePassport selfie:true translation:true]]];
|
||||||
|
button.nonce = @"{request_nonce}";
|
||||||
|
button.delegate = self;
|
||||||
|
[self.view addSubview:button];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)passportButton:(TGPButton *)passportButton
|
||||||
|
didCompleteWithResult:(TGPRequestResult)result
|
||||||
|
error:(NSError *)error {
|
||||||
|
switch (result) {
|
||||||
|
case TGPRequestResultSucceed:
|
||||||
|
NSLog(@"Succeed");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGPRequestResultCancelled:
|
||||||
|
NSLog(@"Cancelled");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NSLog(@"Failed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end</code></pre>
|
||||||
|
<h4><a class="anchor" href="#or-implement-your-own-behavior" id="or-implement-your-own-behavior" name="or-implement-your-own-behavior"><i class="anchor-icon"></i></a>...or Implement Your Own Behavior</h4>
|
||||||
|
<p>If you want to design a custom UI and behavior, you can invoke a Passport request like this:
|
||||||
|
<em>Replace <code>{bot_id}</code>, <code>{bot_public_key}</code> and <code>{request_nonce}</code> with your values</em></p>
|
||||||
|
<pre><code>#import <TGPassportKit/TGPRequest.h>
|
||||||
|
|
||||||
|
- (void)performPassportRequest
|
||||||
|
{
|
||||||
|
TGPBotConfig *botConfig = [[TGPBotConfig alloc] initWithBotId:{bot_id}
|
||||||
|
publicKey:@"{bot_public_key}"];
|
||||||
|
TGPRequest *request = [[TGPRequest alloc] initWithBotConfig:botConfig];
|
||||||
|
[request performWithScope:[[TGPScope alloc] initWithJSONString:@"{\"data\":[\"id_document\",\"phone_number\"],\"v\":1}"]
|
||||||
|
payload:@"{request_nonce}"
|
||||||
|
completionHandler:^(TGPRequestResult result, NSError * _Nullable error) {
|
||||||
|
switch (result) {
|
||||||
|
case TGPRequestResultSucceed:
|
||||||
|
NSLog(@"Succeed");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TGPRequestResultCancelled:
|
||||||
|
NSLog(@"Cancelled");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
NSLog(@"Failed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}</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>
|
||||||
|
<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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></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>
|
||||||
|
|
1
data/corefork.telegram.org/schema/mtproto-json.html
Normal file
1
data/corefork.telegram.org/schema/mtproto-json.html
Normal file
File diff suppressed because one or more lines are too long
128
data/corefork.telegram.org/type/DecryptedDataBlock.html
Normal file
128
data/corefork.telegram.org/type/DecryptedDataBlock.html
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>DecryptedDataBlock</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="description" content="VoIP decrypted data block">
|
||||||
|
<meta property="og:title" content="DecryptedDataBlock">
|
||||||
|
<meta property="og:image" content="">
|
||||||
|
<meta property="og:description" content="VoIP decrypted data block">
|
||||||
|
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
|
||||||
|
<link href="/css/telegram.css?215" 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=""><a href="/api">API</a></li>
|
||||||
|
<li class=""><a href="/mtproto">Protocol</a></li>
|
||||||
|
<li class="active"><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="/schema" >TL-schema</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/type/DecryptedDataBlock" >DecryptedDataBlock</a></li></ul></div>
|
||||||
|
<h1 id="dev_page_title">DecryptedDataBlock</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>VoIP decrypted data block</p>
|
||||||
|
<p><div class="clearfix">
|
||||||
|
<ul class="dev_layer_select slightly-pull-right nav nav-pills">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" onclick="return dropdownClick(this, event)" href="#">Layer 137 <b class="caret"></b></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="?layer=1">1 – Base layer</a></li><li><a href="?layer=2">2 – New userpic notifications</a></li><li><a href="?layer=3">3 – Send message can trigger link change</a></li><li><a href="?layer=4">4 – Check-in chats</a></li><li><a href="?layer=5">5 – Localized SMS, localized notifications</a></li><li><a href="?layer=6">6 – Foursquare integration</a></li><li><a href="?layer=7">7 – Added wallPaperSolid</a></li><li><a href="?layer=8">8 – Added end-to-end encryption</a></li><li><a href="?layer=9">9 – Improved big files upload perfomance</a></li><li><a href="?layer=10">10 – Improved chat participants updates</a></li><li><a href="?layer=11">11 – Improved secret chats</a></li><li><a href="?layer=12">12 – New dynamic support</a></li><li><a href="?layer=13">13 – Audio, video MIME; contacts import retry; new secret actions</a></li><li><a href="?layer=14">14 – Notify settings sync, blacklist sync</a></li><li><a href="?layer=15">15 – Modified getHistory offset behaviour</a></li><li><a href="?layer=16">16 – Split sendCode into 2 parts</a></li><li><a href="?layer=17">17 – Added custom typing, introduced message flags</a></li><li><a href="?layer=18">18 – Added usernames</a></li><li><a href="?layer=23">23 – Stickers for secret chats</a></li><li><a href="?layer=105">105 – Scheduled messages, Cloud themes</a></li><li><a href="?layer=108">108 – Login with QR code</a></li><li><a href="?layer=109">109 – Polls v2</a></li><li><a href="?layer=110">110 – People Nearby 2.0, Bank card entity</a></li><li><a href="?layer=111">111 – Folders, Broadcast Stats</a></li><li><a href="?layer=112">112 – Old featured stickers, generic dice, poll timer, poll solution</a></li><li><a href="?layer=113">113 – PSA</a></li><li><a href="?layer=114">114 – Video thumbs for GIFs</a></li><li><a href="?layer=115">115 – Peek Channel Invite</a></li><li><a href="?layer=116">116 – Group Stats, Profile Videos</a></li><li><a href="?layer=117">117 – WebRTC Phone Calls</a></li><li><a href="?layer=118">118 – Callback with 2FA, Countries list</a></li><li><a href="?layer=119">119 – Comments in channels, Threads, Anonymous Admins</a></li><li><a href="?layer=120">120 – Multipins, Message Stats, GeoLive v2</a></li><li><a href="?layer=121">121 – SVG-based Outlines for Stickers</a></li><li><a href="?layer=122">122 – Voice Chats</a></li><li><a href="?layer=123">123 – Voice Chat improvements</a></li><li><a href="?layer=124">124 – Expiring Invite links</a></li><li><a href="?layer=125">125 – Voice Chats in Broadcasts</a></li><li><a href="?layer=126">126 – Ban channels in channels</a></li><li><a href="?layer=127">127 – Payments in channels</a></li><li><a href="?layer=128">128 – Microthumbs for User/Chat profile photos</a></li><li><a href="?layer=129">129 – Video Chats</a></li><li><a href="?layer=130">130 – Custom placeholder for bot reply keyboards</a></li><li><a href="?layer=131">131 – Reset 2FA Password after a week</a></li><li><a href="?layer=132">132 – Chat themes</a></li><li><a href="?layer=133">133 – 64-bit IDs for User/Chat</a></li><li><a href="?layer=137"><strong>137 – reactions</strong></a></li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a href="/api/layers">More...</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<pre class="page_scheme"><code>Type schema is not available in the selected layer.</code></pre></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="//core.telegram.org/">Platform</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
||||||
|
|
||||||
|
<script>backToTopInit("Go up");
|
||||||
|
removePreloadInit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -1,226 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Discussion Widget</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta property="description" content="You can embed discussions from any public channel on your website. You only need a link to a post with comments to embed…">
|
|
||||||
<meta property="og:title" content="Discussion Widget">
|
|
||||||
<meta property="og:image" content="">
|
|
||||||
<meta property="og:description" content="You can embed discussions from any public channel on your website. You only need a link to a post with comments to embed…">
|
|
||||||
<link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />
|
|
||||||
|
|
||||||
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
|
||||||
<link href="/css/bootstrap-extra.css?2" rel="stylesheet">
|
|
||||||
<link href="/css/core-widgets.css?1" rel="stylesheet">
|
|
||||||
|
|
||||||
<link href="/css/telegram.css?215" 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=""><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="/widgets" >Widgets</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/widgets/discussion" >Discussion Widget</a></li></ul></div>
|
|
||||||
<h1 id="dev_page_title">Discussion Widget</h1>
|
|
||||||
|
|
||||||
<div id="dev_page_content"><p>You can <strong>embed discussions from any public channel</strong> on your website. You only need a link to a post with comments to embed it together with all discussion. </p>
|
|
||||||
<p>If you have a website with articles and a telegram channel where you post links to these articles, you can use this widget to show discussions from that channel on your website. In this case you only need a link to the channel. Discussions will be available on your website as soon as you post a link into the channel. For this to work, you should add the <code><link rel="canonical" href="%page_url%"></code> tag to the page header where <code>%page_url%</code> is the canonical URL of the current page.</p>
|
|
||||||
<h3><a class="anchor" name="configure-widget" href="#configure-widget"><i class="anchor-icon"></i></a>Configure widget</h3>
|
|
||||||
<p>You can choose options for your widget using the form below.</p>
|
|
||||||
<p><form class="form-horizontal form-telegram clearfix" id="discussion_widget_config">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label">Link to post:</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="textfield-item">
|
|
||||||
<input id="post_link" name="post_link" type="text" class="form-control" placeholder="link to a public post or a channel">
|
|
||||||
<div class="textfield-item-underline"></div>
|
|
||||||
<span class="textfield-item-error" id="post_link_error"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label">Comments limit:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="textfield-item" style="width:100%">
|
|
||||||
<input id="comments_limit" name="comments_limit" type="text" autocomplete="off" class="form-control" placeholder="5" maxlength="2">
|
|
||||||
<div class="textfield-item-underline"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<label class="col-md-2 control-label">Height:</label>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="textfield-item" style="width:100%">
|
|
||||||
<input id="height" name="height" type="text" autocomplete="off" class="form-control" placeholder="auto" maxlength="4">
|
|
||||||
<div class="textfield-item-underline"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label">Accent color:</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="widget-accent-colors">
|
|
||||||
<label class="widget-accent-color-item">
|
|
||||||
<input type="radio" class="radio" name="color" value="default" checked />
|
|
||||||
<div class="widget-color-circle"></div>
|
|
||||||
<div class="widget-color-label">Default</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item" data-color="13B4C6" data-bg-color="13C5D9" data-dark-color="39C4E8">
|
|
||||||
<input type="radio" class="radio" name="color" value="13B4C6" />
|
|
||||||
<div class="widget-color-circle" style="background-color: #13C5D9;"></div>
|
|
||||||
<div class="widget-color-label">Cyan</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item" data-color="29B127" data-bg-color="4CB94E" data-dark-color="72E350">
|
|
||||||
<input type="radio" class="radio" name="color" value="29B127" />
|
|
||||||
<div class="widget-color-circle" style="background-color: #4CB94E;"></div>
|
|
||||||
<div class="widget-color-label">Green</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item" data-color="CA9C0E" data-bg-color="E8B824" data-dark-color="F0B138">
|
|
||||||
<input type="radio" class="radio" name="color" value="CA9C0E" />
|
|
||||||
<div class="widget-color-circle" style="background-color: #E8B824;"></div>
|
|
||||||
<div class="widget-color-label">Yellow</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item" data-color="E22F38" data-bg-color="F34750" data-dark-color="F95C54">
|
|
||||||
<input type="radio" class="radio" name="color" value="E22F38" />
|
|
||||||
<div class="widget-color-circle" style="background-color: #F34750;"></div>
|
|
||||||
<div class="widget-color-label">Red</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item" data-color="343638" data-bg-color="343638" data-dark-color="FFFFFF" data-text="Black" data-dark-text="White">
|
|
||||||
<input type="radio" class="radio" name="color" value="343638" />
|
|
||||||
<div class="widget-color-circle" style="background-color: #343638;"></div>
|
|
||||||
<div class="widget-color-label">Black</div>
|
|
||||||
</label>
|
|
||||||
<label class="widget-accent-color-item">
|
|
||||||
<input type="radio" class="radio" name="color" value="custom">
|
|
||||||
<div class="widget-color-circle widget-color-circle-custom" style="color: #F646A4;"></div>
|
|
||||||
<div class="widget-color-label widget-color-label-custom">Custom</div>
|
|
||||||
<div class="textfield-item widget-accent-color-field-item">
|
|
||||||
<input class="form-control widget-accent-color-field" name="customcolor" type="text" autocomplete="off" value="F646A4" maxlength="6">
|
|
||||||
<div class="textfield-item-underline"></div>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<label class="checkbox-item checkbox-item-block">
|
|
||||||
<input type="checkbox" class="checkbox" name="colorful" value="1" />
|
|
||||||
<span class="checkbox-input ripple-handler"><span class="ripple-mask"><span class="ripple"></span></span><span class="checkbox-input-icon"></span></span><span class="checkbox-label">Use different colors for names</span>
|
|
||||||
</label>
|
|
||||||
<label class="checkbox-item checkbox-item-block">
|
|
||||||
<input type="checkbox" class="checkbox" name="dark" value="1" />
|
|
||||||
<span class="checkbox-input ripple-handler"><span class="ripple-mask"><span class="ripple"></span></span><span class="checkbox-input-icon"></span></span><span class="checkbox-label">Dark theme</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="embed_code" class="col-md-3 control-label">Embed Code:</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<textarea id="embed_code" class="form-control embed_code" rows="5" readonly onclick="this.select();"></textarea>
|
|
||||||
<div class="help-block canonical-helper hide">Make sure you have a <code><link rel="canonical" href="%page_url%"></code> tag in the page header with the canonical url of the current page.</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-1 col-md-10">
|
|
||||||
<div class="widget_container row" id="widget_container"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form></p>
|
|
||||||
<h3><a class="anchor" name="basic-comments" href="#basic-comments"><i class="anchor-icon"></i></a>Basic comments</h3>
|
|
||||||
<p>If you're looking to simply add Telegram comments to <strong>pages on your website</strong>, without linking them with a channel, you can use our <a href="https://comments.app/">basic comments</a> solution.</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="//core.telegram.org/">Platform</a></h5>
|
|
||||||
<ul>
|
|
||||||
<li><a href="//core.telegram.org/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="//core.telegram.org/">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?43"></script>
|
|
||||||
<script src="/js/jquery.min.js?1"></script>
|
|
||||||
<script src="/js/jquery-ui.min.js?1"></script>
|
|
||||||
<script src="/js/bootstrap.min.js?1"></script>
|
|
||||||
<script src="/js/core-widgets.js?1"></script>
|
|
||||||
|
|
||||||
<script>DiscussionWidget.init({"default_link":"https:\/\/t.me\/durov\/126","link_error":"Invalid post link","widget_script":"https:\/\/telegram.org\/js\/telegram-widget.js?15"});
|
|
||||||
backToTopInit("Go up");
|
|
||||||
removePreloadInit();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
3156
data/promote.telegram.org/css/promote.css
Normal file
3156
data/promote.telegram.org/css/promote.css
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
241
data/tsf.telegram.org/auth.html
Normal file
241
data/tsf.telegram.org/auth.html
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Telegram Support Force</title>
|
||||||
|
<meta property="og:title" content="Telegram Support Initiative">
|
||||||
|
<meta property="og:image" content="https://core.telegram.org/file/811140603/2/0745mO0fIsg.128926/2a9d2f75d33ba526ae">
|
||||||
|
<meta property="og:description" content="Our users ask us tens of thousands of questions each day. We would like to answer them all — and we are looking for brilliant people from all over the world who would like to help us do this. Join us today!">
|
||||||
|
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
|
||||||
|
<link rel="alternate icon" href="/favicon.ico?4" type="image/x-icon" />
|
||||||
|
<script>document.cookie="stel_dt="+encodeURIComponent((new Date).getTimezoneOffset())+";path=/;max-age=31536000;samesite=None;secure"</script>
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet" type="text/css">
|
||||||
|
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
|
||||||
|
<link href="/css/bootstrap-extra.css?2" rel="stylesheet">
|
||||||
|
<link href="/css/telegram.css?215" rel="stylesheet">
|
||||||
|
<link href="/css/tsf.css?7" rel="stylesheet">
|
||||||
|
<link href="/css/jquery-ui.min.css?1" rel="stylesheet">
|
||||||
|
<link href="/css/health.css?132" rel="stylesheet">
|
||||||
|
<link href="/css/tchart.min.css?10" rel="stylesheet">
|
||||||
|
<link href="/css/billboard.css?17" rel="stylesheet">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="emoji_image no-transition">
|
||||||
|
|
||||||
|
<div id="aj_progress" class="progress-bar"></div>
|
||||||
|
|
||||||
|
<div id="aj_content"><div class="tr-container">
|
||||||
|
<header>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header-wrap">
|
||||||
|
<div id="header-panel" class="header-panel">
|
||||||
|
<div class="header-auth">
|
||||||
|
<div class="header-auth-item"><a class="header-search-btn"></a></div><div class="header-auth-item"><a class="header-auth-link login-link" href="/auth">Login</a></div>
|
||||||
|
</div>
|
||||||
|
<div class="header-breadcrumb header-breadcrumb-simple">
|
||||||
|
<ol id="breadcrumb" class="header-nav breadcrumb"><li><a href="/">Telegram Support Force</a></li></ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main class="container">
|
||||||
|
<nav class="tr-menu">
|
||||||
|
<div class="tr-menu-section">
|
||||||
|
<div class="tr-menu-header">
|
||||||
|
<div class="tr-menu-header-label">Resources</div>
|
||||||
|
</div>
|
||||||
|
<ul class="tr-menu-items"><li class="active">
|
||||||
|
<a class="tr-menu-item" href="/">
|
||||||
|
<span class="nav-label">Introduction</span>
|
||||||
|
</a>
|
||||||
|
</li><li>
|
||||||
|
<a class="tr-menu-item" href="/manuals">
|
||||||
|
<span class="nav-label">Manuals</span>
|
||||||
|
</a>
|
||||||
|
</li></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
<section class="content clearfix">
|
||||||
|
<section class="tr-content"><div id="dev_page_content_wrap" class=" ">
|
||||||
|
<div class="dev_page_bread_crumbs"></div>
|
||||||
|
<h1 id="dev_page_title">Telegram Support Initiative</h1>
|
||||||
|
|
||||||
|
<div id="dev_page_content"><p>Our users ask us tens of thousands of questions each day. We would like to answer them all — and we are looking for brilliant people from all over the world who would like to help us do this. If you are interested in joining us, please read this <strong>Telegram Support Force Manifesto</strong> — and don't miss the tiny <a href="#manifesto-faq">FAQ</a> below.</p>
|
||||||
|
<div>
|
||||||
|
<a href="/file/811140929/1/Iw57U2SgB-s.2388488/f8f9363c8bd7be05a7" target="_blank"><img src="/file/811140603/2/0745mO0fIsg.128926/2a9d2f75d33ba526ae" title="Telegram Support Initiative. Enlist today! (click for hi-res version)" class="dev_page_image" /></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3><a class="anchor-link" href="#harnessing-the-power-of-procrastination"><i class="anchor-icon"></i></a><a class="anchor" name="harnessing-the-power-of-procrastination"></a>Harnessing the power of procrastination</h3>
|
||||||
|
<ol>
|
||||||
|
<li><p>Telegram is a free messaging system that is used by tens of millions of people daily. Each of our apps has an ‘Ask a question’ button. Our users press it thousands of times each day: some have questions, others just want to chat, still others are bored trolls. We think that they all deserve an answer of some kind.</p>
|
||||||
|
</li>
|
||||||
|
<li><p>Robots and algorithms are good at handing out answers at scale, but they sometimes cause frustration, fundamentally lack human touch and are bad conversation partners. FAQs are a remedy for the select few that enjoy finding answers in FAQs. To be happy, humanity requires human answers.</p>
|
||||||
|
</li>
|
||||||
|
<li><p>Manually answering tens of thousands of questions daily requires considerable resources. Manually answering them in style — even when assisted by algorithms and templates — requires limitless resources. But, the resources in question being humans and time, the modern world happens to have a limitless source of just such energy. </p>
|
||||||
|
</li>
|
||||||
|
<li><p>This world is full of bright-minded, elegant, downright wonderful people who, like you and me, sometimes just can't get started with whatever they were supposed to be doing. And procrastinate instead. This brings countless people in any profession to hours and hours of unnecessary house-cleaning, dog-walking and web-surfing every day. Millions of hours go to waste — procrastination is as ubiquitous in the XXI century as are people who do their work behind computer screens.</p>
|
||||||
|
</li>
|
||||||
|
<li><p>It is our goal to harness the power of procrastination. For user support, we rely on an army of volunteers from all over the world. They donate a fraction of their time to answer a few questions from Telegram users — every now and then, or all the time. We call this the Telegram Support Force and you are welcome to join.</p>
|
||||||
|
</li>
|
||||||
|
<li><p>Answering questions may be devilishly tricky at times, so we couldn't accept everyone even if we wanted to. The Telegram Support Force needs patient, inquisitive people, who are no strangers to elegance, humor and style. Although Telegram volunteers help people from their own countries, proficiency in English is also a requirement, since the data you will be getting from us, as well as pretty much all communication inside the team, will be in English.</p>
|
||||||
|
</li>
|
||||||
|
<li><p>We believe in support as an art form. Support should be fun — for people on both ends of the line. So we are looking for perfect, human and precise answers to the world's questions. Something to make them smile and to make you proud.</p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
<p>If this is something you might be interested in doing, don't hesitate to contact our <a href="https://telegram.me/TelegramAuditions">@TelegramAuditions</a> account. Please write us a few phrases in English describing how your favourite feature works (don’t copy it, let it be your hand-made text). Include a picture of a marmot if you want a better chance at convincing us that you actually read all of the above and below and, therefore, are inquisitive enough.</p>
|
||||||
|
<p>Markus Ra<br>@Telegram</p>
|
||||||
|
<hr>
|
||||||
|
<h3><a class="anchor-link" href="#manifesto-faq"><i class="anchor-icon"></i></a><a class="anchor" name="manifesto-faq"></a>Manifesto FAQ</h3>
|
||||||
|
<h4><a class="anchor-link" href="#q-do-i-need-to-know-anything-special-to-be-eligible"><i class="anchor-icon"></i></a><a class="anchor" name="q-do-i-need-to-know-anything-special-to-be-eligible"></a>Q: Do I need to know anything special to be eligible?</h4>
|
||||||
|
<p>No, not really. But you do need to know how to learn things. And be inquisitive enough to want to learn them.</p>
|
||||||
|
<h4><a class="anchor-link" href="#q-what-else-is-required"><i class="anchor-icon"></i></a><a class="anchor" name="q-what-else-is-required"></a>Q: What else is required?</h4>
|
||||||
|
<p>We‘re looking for perfectionists. It’d also be nice if you loved your language and had at least a moderate affection for the people of Earth. It'd be cool if you like to read and write. And then, patience and understanding are very useful at times.</p>
|
||||||
|
<h4><a class="anchor-link" href="#q-will-the-people-i-answer-know-who-i-am-or-get-my-number"><i class="anchor-icon"></i></a><a class="anchor" name="q-will-the-people-i-answer-know-who-i-am-or-get-my-number"></a>Q: Will the people I answer know who I am or get my number?</h4>
|
||||||
|
<p>No, they will not. Unless you choose to tell them for some mysterious reason.</p>
|
||||||
|
<h4><a class="anchor-link" href="#q-what-should-i-say-when-i-contact-you"><i class="anchor-icon"></i></a><a class="anchor" name="q-what-should-i-say-when-i-contact-you"></a>Q: What should I say when I contact you?</h4>
|
||||||
|
<p>We'd love to know more about you (who you are, what you think, what you like — not a CV, no!), the languages you speak and the devices you use (mobile, desktop OS).</p>
|
||||||
|
<h4><a class="anchor-link" href="#q-how-long-does-it-take-for-you-to-reply"><i class="anchor-icon"></i></a><a class="anchor" name="q-how-long-does-it-take-for-you-to-reply"></a>Q: How long does it take for you to reply?</h4>
|
||||||
|
<p>We try not to take too long. But we sometimes do, so we apologize in advance. Sorry. Don‘t lose heart and remember that thing about patience above. We’ll get back to you as soon as we can.</p>
|
||||||
|
<h4><a class="anchor-link" href="#q-is-that-thing-about-sending-a-marmot-picture-a-joke"><i class="anchor-icon"></i></a><a class="anchor" name="q-is-that-thing-about-sending-a-marmot-picture-a-joke"></a>Q: Is that thing about sending a marmot picture a joke?</h4>
|
||||||
|
<p>No.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div></section>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</div><div class="popup-container login-popup-container hide" id="login-popup-container">
|
||||||
|
<div class="popup">
|
||||||
|
<div class="popup-body">
|
||||||
|
<section>
|
||||||
|
<h2>Log In</h2>
|
||||||
|
<p>Log in here to access your TSF stats. Please enter your <b>phone number</b> in the <a target="_blank" rel="noopener" href="https://telegram.org/faq#login-and-sms">international format</a> and we will send a confirmation message to your account via Telegram.</p>
|
||||||
|
|
||||||
|
<form id="send-form" class="login-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="tel" class="form-control tr-form-control input-lg" id="phone-number" placeholder="+12223334455" autocomplete="off"/>
|
||||||
|
</div>
|
||||||
|
<div class="popup-buttons">
|
||||||
|
<a class="btn btn-link btn-lg login-cancel-btn">Cancel</a><button type="submit" class="btn btn-link btn-lg">Next</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div id="login-form" class="hide">
|
||||||
|
<div class="form-group">
|
||||||
|
<span class="form-control tr-form-control input input-lg input-disabled"><strong id="phone-number-field"></strong> (<a class="login-back" href="/auth">Incorrect?</a>)</span>
|
||||||
|
<p class="help-block dots-animated">We've just sent you a message.<br/>Please confirm access via Telegram</p>
|
||||||
|
</div>
|
||||||
|
<div class="popup-buttons">
|
||||||
|
<a class="btn btn-link btn-lg login-cancel-btn">Cancel</a><a class="btn btn-link btn-lg login-back">Back</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div></div>
|
||||||
|
<script src="/js/jquery.min.js?1"></script>
|
||||||
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/js/main-aj.js?56"></script>
|
||||||
|
<script src="/js/main.js?43"></script>
|
||||||
|
<script src="/js/tsf.js?3"></script>
|
||||||
|
<script src="/js/jquery-ui.min.js?1"></script>
|
||||||
|
<script src="/js/tchart.min.js?18"></script>
|
||||||
|
<script src="/js/billboard.min.js?1"></script>
|
||||||
|
<script src="/js/stats.js?17"></script>
|
||||||
|
|
||||||
|
<script>ajInit({"version":527,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
|
||||||
|
<script id="aj_script">openPopup('#login-popup-container');
|
||||||
|
Aj.onLoad(function(state) {
|
||||||
|
function requestConfirmation(event) {
|
||||||
|
event && event.preventDefault();
|
||||||
|
var phone = $('#phone-number').val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/auth/request',
|
||||||
|
data: {
|
||||||
|
phone: phone
|
||||||
|
},
|
||||||
|
success: function(result) {
|
||||||
|
$('#phone-number-field').text(phone);
|
||||||
|
$('#send-form').addClass('hide');
|
||||||
|
$('#login-form').removeClass('hide');
|
||||||
|
checkAuth(result.temp_session);
|
||||||
|
},
|
||||||
|
error: function(xhr) {
|
||||||
|
showAlert(xhr.responseText || 'Server error');
|
||||||
|
},
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function cancelConfirmation(event) {
|
||||||
|
event && event.preventDefault();
|
||||||
|
$('#phone-number-field').text('');
|
||||||
|
$('#send-form').removeClass('hide');
|
||||||
|
$('#login-form').addClass('hide');
|
||||||
|
$('#phone-number').focus();
|
||||||
|
clearTimeout(window.authTimeout);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function checkAuth(temp_session) {
|
||||||
|
clearTimeout(window.authTimeout);
|
||||||
|
window.authTimeout = setTimeout(function doCheckAuth() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '/auth/login',
|
||||||
|
data: {
|
||||||
|
temp_session: temp_session
|
||||||
|
},
|
||||||
|
success: function(result) {
|
||||||
|
if (result) {
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
checkAuth(temp_session);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
showAlert(xhr.responseText || 'Server error');
|
||||||
|
},
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
}, 700);
|
||||||
|
}
|
||||||
|
$('#login-popup-container').on('popup:open', function() {
|
||||||
|
$('#phone-number').focus();
|
||||||
|
});
|
||||||
|
$('#login-popup-container').on('popup:close', function() {
|
||||||
|
cancelConfirmation();
|
||||||
|
if (location.pathname == '/auth') {
|
||||||
|
window.history && history.replaceState(null, null, '/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#login-popup-container #send-form').on('submit', requestConfirmation);
|
||||||
|
$('#login-popup-container .login-cancel-btn').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
closePopup('#login-popup-container');
|
||||||
|
});
|
||||||
|
$('#login-popup-container .login-back').on('click', cancelConfirmation);
|
||||||
|
$('.login-link').on('click', function(e) {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
openPopup('#login-popup-container');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Aj.onUnload(function(state) {
|
||||||
|
$('#login-popup-container').off('popup:open');
|
||||||
|
$('#login-popup-container').off('popup:close');
|
||||||
|
$('#login-popup-container #send-form').off('submit');
|
||||||
|
$('#login-popup-container .login-cancel-btn').off('click');
|
||||||
|
$('#login-popup-container .login-back').off('click');
|
||||||
|
$('.login-link').off('click');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>Aj.pageLoaded();</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
13
data/tsf.telegram.org/js/billboard.min.js
vendored
Normal file
13
data/tsf.telegram.org/js/billboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue