2017-04-15 14:23:17 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
<title>Telethon API</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2018-05-23 19:50:28 +03:00
|
|
|
<link id="style" href="css/docs.light.css" rel="stylesheet">
|
|
|
|
<script>
|
2018-05-24 12:22:52 +03:00
|
|
|
(function () {
|
|
|
|
var style = document.getElementById('style');
|
|
|
|
|
|
|
|
// setTheme(<link />, 'light' / 'dark')
|
|
|
|
function setTheme(theme) {
|
2018-06-27 11:36:56 +03:00
|
|
|
localStorage.setItem('theme', theme);
|
2018-05-24 12:22:52 +03:00
|
|
|
return style.href = 'css/docs.' + theme + '.css';
|
|
|
|
}
|
|
|
|
|
|
|
|
// setThemeOnClick(<link />, 'light' / 'dark', <a />)
|
|
|
|
function setThemeOnClick(theme, button) {
|
|
|
|
return button.addEventListener('click', function (e) {
|
|
|
|
setTheme(theme);
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-06-27 11:36:56 +03:00
|
|
|
setTheme(localStorage.getItem('theme') || 'light');
|
2018-05-24 12:22:52 +03:00
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
setThemeOnClick('light', document.getElementById('themeLight'));
|
|
|
|
setThemeOnClick('dark', document.getElementById('themeDark'));
|
|
|
|
});
|
|
|
|
})();
|
2018-05-23 19:50:28 +03:00
|
|
|
</script>
|
2017-04-15 14:23:17 +03:00
|
|
|
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro" rel="stylesheet">
|
2017-04-15 14:58:21 +03:00
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
overflow: scroll;
|
|
|
|
}
|
|
|
|
</style>
|
2017-04-15 14:23:17 +03:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main_div">
|
2018-01-20 15:11:22 +03:00
|
|
|
<noscript>Please enable JavaScript if you would like to use search.</noscript>
|
2017-04-15 14:23:17 +03:00
|
|
|
<h1>Telethon API</h1>
|
|
|
|
<p>This documentation was generated straight from the <code>scheme.tl</code>
|
|
|
|
provided by Telegram. However, there is no official documentation per se
|
|
|
|
on what the methods, constructors and types mean. Nevertheless, this
|
|
|
|
page aims to provide easy access to all the available methods, their
|
|
|
|
definition and parameters.</p>
|
2018-05-24 12:22:52 +03:00
|
|
|
<p id="themeSelect">
|
|
|
|
<a href="#" id="themeLight">light</a> /
|
|
|
|
<a href="#" id="themeDark">dark</a> theme.
|
|
|
|
</p>
|
2018-01-20 13:47:17 +03:00
|
|
|
<p>Please note that when you see this:</p>
|
|
|
|
<pre>---functions---
|
|
|
|
users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User></pre>
|
|
|
|
|
|
|
|
<p>This is <b>not</b> Python code. It's the "TL definition". It's
|
|
|
|
an easy-to-read line that gives a quick overview on the parameters
|
|
|
|
and its result. You don't need to worry about this. See
|
|
|
|
<a href="http://telethon.readthedocs.io/en/latest/extra/developing/understanding-the-type-language.html">here</a>
|
|
|
|
for more details on it.</p>
|
2017-04-15 14:23:17 +03:00
|
|
|
|
2017-04-15 15:15:40 +03:00
|
|
|
<h3>Index</h3>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<a href="#methods">Methods</a>
|
|
|
|
(<a href="methods/index.html">full list</a>)
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="#types">Types</a>
|
|
|
|
(<a href="types/index.html">full list</a>)
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="#constructors">Constructors</a>
|
|
|
|
(<a href="constructors/index.html">full list</a>)
|
|
|
|
</li>
|
|
|
|
<li><a href="#core">Core types</a></li>
|
|
|
|
<li><a href="#example">Full example</a></li>
|
|
|
|
</ul>
|
2017-04-15 14:23:17 +03:00
|
|
|
|
2017-04-15 15:15:40 +03:00
|
|
|
<h3 id="methods">Methods</h3>
|
|
|
|
<p>Currently there are <b>{method_count} methods</b> available for the layer
|
|
|
|
{layer}. The complete list can be seen <a href="methods/index.html">here</a>.
|
|
|
|
<br /><br />
|
2018-01-20 13:47:17 +03:00
|
|
|
Methods, also known as <i>requests</i>, are used to interact with the
|
|
|
|
Telegram API itself and are invoked through <code>client(Request(...))</code>.
|
|
|
|
<b>Only these</b> can be used like that! You cannot invoke types or
|
|
|
|
constructors, only requests. After this, Telegram will return a
|
|
|
|
<code>result</code>, which may be, for instance, a bunch of messages,
|
|
|
|
some dialogs, users, etc.</p>
|
2017-04-15 14:23:17 +03:00
|
|
|
|
|
|
|
<h3 id="types">Types</h3>
|
|
|
|
<p>Currently there are <b>{type_count} types</b>. You can see the full
|
|
|
|
list <a href="types/index.html">here</a>.</p>
|
|
|
|
|
|
|
|
<p>The Telegram types are the <i>abstract</i> results that you receive
|
|
|
|
after invoking a request. They are "abstract" because they can have
|
|
|
|
multiple constructors. For instance, the abstract type <code>User</code>
|
|
|
|
can be either <code>UserEmpty</code> or <code>User</code>. You should,
|
|
|
|
most of the time, make sure you received the desired type by using
|
|
|
|
the <code>isinstance(result, Constructor)</code> Python function.
|
|
|
|
|
|
|
|
When a request needs a Telegram type as argument, you should create
|
|
|
|
an instance of it by using one of its, possibly multiple, constructors.</p>
|
|
|
|
|
|
|
|
<h3 id="constructors">Constructors</h3>
|
|
|
|
<p>Currently there are <b>{constructor_count} constructors</b>. You can see
|
|
|
|
the full list <a href="constructors/index.html">here</a>.</p>
|
|
|
|
|
|
|
|
<p>Constructors are the way you can create instances of the abstract types
|
|
|
|
described above, and also the instances which are actually returned from
|
|
|
|
the functions although they all share a common abstract type.</p>
|
|
|
|
|
|
|
|
<h3 id="core">Core types</h3>
|
|
|
|
<p>Core types are types from which the rest of Telegram types build upon:</p>
|
|
|
|
<ul>
|
|
|
|
<li id="int"><b>int</b>:
|
|
|
|
The value should be an integer type, like <span class="sh1">42</span>.
|
|
|
|
It should have 32 bits or less. You can check the bit length by
|
|
|
|
calling <code>a.bit_length()</code>, where <code>a</code> is an
|
|
|
|
integer variable.
|
|
|
|
</li>
|
|
|
|
<li id="long"><b>long</b>:
|
|
|
|
Different name for an integer type. The numbers given should have
|
|
|
|
64 bits or less.
|
|
|
|
</li>
|
|
|
|
<li id="int128"><b>int128</b>:
|
|
|
|
Another integer type, should have 128 bits or less.
|
|
|
|
</li>
|
|
|
|
<li id="int256"><b>int256</b>:
|
|
|
|
The largest integer type, allowing 256 bits or less.
|
|
|
|
</li>
|
|
|
|
<li id="double"><b>double</b>:
|
|
|
|
The value should be a floating point value, such as
|
|
|
|
<span class="sh1">123.456</span>.
|
|
|
|
</li>
|
|
|
|
<li id="vector"><b>Vector<T></b>:
|
|
|
|
If a type <code>T</code> is wrapped around <code>Vector<T></code>,
|
|
|
|
then it means that the argument should be a <i>list</i> of it.
|
|
|
|
For instance, a valid value for <code>Vector<int></code>
|
|
|
|
would be <code>[1, 2, 3]</code>.
|
|
|
|
</li>
|
|
|
|
<li id="string"><b>string</b>:
|
|
|
|
A valid UTF-8 string should be supplied. This is right how
|
|
|
|
Python strings work, no further encoding is required.
|
|
|
|
</li>
|
|
|
|
<li id="bool"><b>Bool</b>:
|
|
|
|
Either <code>True</code> or <code>False</code>.
|
|
|
|
</li>
|
2018-07-25 03:21:44 +03:00
|
|
|
<li id="true"><b>flag</b>:
|
2017-04-15 14:23:17 +03:00
|
|
|
These arguments aren't actually sent but rather encoded as flags.
|
|
|
|
Any truthy value (<code>True</code>, <code>7</code>) will enable
|
|
|
|
this flag, although it's recommended to use <code>True</code> or
|
|
|
|
<code>None</code> to symbolize that it's not present.
|
|
|
|
</li>
|
|
|
|
<li id="bytes"><b>bytes</b>:
|
|
|
|
A sequence of bytes, like <code>b'hello'</code>, should be supplied.
|
|
|
|
</li>
|
|
|
|
<li id="date"><b>date</b>:
|
|
|
|
Although this type is internally used as an <code>int</code>,
|
2018-01-23 12:01:58 +03:00
|
|
|
you can pass a <code>datetime</code> or <code>date</code> object
|
|
|
|
instead to work with date parameters.<br />
|
|
|
|
Note that the library uses the date in <b>UTC+0</b>, since timezone
|
|
|
|
conversion is not responsibility of the library. Furthermore, this
|
|
|
|
eases converting into any other timezone without the need for a middle
|
|
|
|
step.
|
2017-04-15 14:23:17 +03:00
|
|
|
</li>
|
|
|
|
</ul>
|
2017-04-15 15:15:40 +03:00
|
|
|
|
|
|
|
<h3 id="example">Full example</h3>
|
2018-01-20 13:47:17 +03:00
|
|
|
<p>Documentation for this is now
|
|
|
|
<a href="http://telethon.readthedocs.io/en/latest/extra/advanced-usage/accessing-the-full-api.html">here</a>.
|
|
|
|
</p>
|
2017-04-15 14:23:17 +03:00
|
|
|
</div>
|
2018-01-20 15:11:22 +03:00
|
|
|
<script src="js/search.js"></script>
|
2017-04-15 14:23:17 +03:00
|
|
|
</body>
|
|
|
|
</html>
|