mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-30 17:43:32 +00:00
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
|
||||
===============
|
||||
|
||||
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
|
||||
:emphasize-lines: 1
|
||||
@ -10,8 +12,11 @@ This page is about Pyrogram types. All types listed here are accessible through
|
||||
|
||||
.. note::
|
||||
|
||||
**Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown
|
||||
when, for example, using ``print()``.
|
||||
Optional fields always exist inside the object, but they could be empty and contain the value of ``None``.
|
||||
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
|
||||
:backlinks: none
|
||||
|
Loading…
Reference in New Issue
Block a user