Update types.rst
This commit is contained in:
parent
2d785acdc7
commit
3445507a9a
11
compiler/docs/template/types.rst
vendored
11
compiler/docs/template/types.rst
vendored
@ -1,7 +1,9 @@
|
|||||||
Available Types
|
Available Types
|
||||||
===============
|
===============
|
||||||
|
|
||||||
This page is about Pyrogram types. All types listed here are accessible through ``types`` package.
|
This page is about Pyrogram Types. All types listed here are available through the ``pyrogram.types`` package.
|
||||||
|
Unless required as argument to a client method, most of the types don't need to be manually instantiated because they
|
||||||
|
are only returned by other methods. You also don't need to import them, unless you want to type-hint your variables.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:emphasize-lines: 1
|
:emphasize-lines: 1
|
||||||
@ -10,8 +12,11 @@ This page is about Pyrogram types. All types listed here are accessible through
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
**Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown
|
Optional fields always exist inside the object, but they could be empty and contain the value of ``None``.
|
||||||
when, for example, using ``print()``.
|
Empty fields aren't shown when, for example, using ``print(message)`` and this means that
|
||||||
|
``hasattr(message, "photo")`` always returns ``True``.
|
||||||
|
|
||||||
|
To tell whether a field is set or not, do a simple boolean check: ``if message.photo: ...``.
|
||||||
|
|
||||||
.. contents:: Contents
|
.. contents:: Contents
|
||||||
:backlinks: none
|
:backlinks: none
|
||||||
|
Loading…
Reference in New Issue
Block a user