Skip to content

Commit 3445507

Browse files
committed
Update types.rst
1 parent 2d785ac commit 3445507

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

compiler/docs/template/types.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Available Types
22
===============
33

4-
This page is about Pyrogram types. All types listed here are accessible through ``types`` package.
4+
This page is about Pyrogram Types. All types listed here are available through the ``pyrogram.types`` package.
5+
Unless required as argument to a client method, most of the types don't need to be manually instantiated because they
6+
are only returned by other methods. You also don't need to import them, unless you want to type-hint your variables.
57

68
.. code-block:: python
79
:emphasize-lines: 1
@@ -10,8 +12,11 @@ This page is about Pyrogram types. All types listed here are accessible through
1012
1113
.. note::
1214

13-
**Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown
14-
when, for example, using ``print()``.
15+
Optional fields always exist inside the object, but they could be empty and contain the value of ``None``.
16+
Empty fields aren't shown when, for example, using ``print(message)`` and this means that
17+
``hasattr(message, "photo")`` always returns ``True``.
18+
19+
To tell whether a field is set or not, do a simple boolean check: ``if message.photo: ...``.
1520

1621
.. contents:: Contents
1722
:backlinks: none

0 commit comments

Comments
 (0)