This documentation was generated straight from the
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.
Please note that when you see this:
---functions--- users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>
This is not 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 Understanding the Type Language for more details on it.
Currently there are 300 methods available for the layer
95. See the complete method list.
Methods, also known as requests, are used to interact with the Telegram API itself and are invoked through
Only these can be used like that! You cannot invoke types or
constructors, only requests. After this, Telegram will return a
result, which may be, for instance, a bunch of messages,
some dialogs, users, etc.
Currently there are 277 types. See the complete list of types.
The Telegram types are the abstract results that you receive
after invoking a request. They are "abstract" because they can have
multiple constructors. For instance, the abstract type
can be either
User. You should,
most of the time, make sure you received the desired type by using
isinstance(result, Constructor) 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.
Currently there are 758 constructors. See the list of all constructors.
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.
Core types are types from which the rest of Telegram types build upon:
The value should be an integer type, like 42.
It should have 32 bits or less. You can check the bit length by
ais an integer variable.
- long: Different name for an integer type. The numbers given should have 64 bits or less.
- int128: Another integer type, should have 128 bits or less.
- int256: The largest integer type, allowing 256 bits or less.
- double: The value should be a floating point value, such as 123.456.
If a type
Tis wrapped around
Vector<T>, then it means that the argument should be a list of it. For instance, a valid value for
[1, 2, 3].
- string: A valid UTF-8 string should be supplied. This is right how Python strings work, no further encoding is required.
These arguments aren't actually sent but rather encoded as flags.
Any truthy value (
7) will enable this flag, although it's recommended to use
Noneto symbolize that it's not present.
A sequence of bytes, like
b'hello', should be supplied.
Although this type is internally used as an
int, you can pass a
dateobject instead to work with date parameters.
Note that the library uses the date in UTC+0, since timezone conversion is not responsibility of the library. Furthermore, this eases converting into any other timezone without the need for a middle step.
All methods shown here have dummy examples on how to write them, so you don't get confused with their TL definition. However, this may not always run. They are just there to show the right syntax.
You should check out how to access the full API in ReadTheDocs.