From 3445507a9a7b3a2b354385dbd4d9a5ad08dfd0e4 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 20 Mar 2021 07:41:49 +0100 Subject: [PATCH] Update types.rst --- compiler/docs/template/types.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/docs/template/types.rst b/compiler/docs/template/types.rst index e6c9a5d7..8b340006 100644 --- a/compiler/docs/template/types.rst +++ b/compiler/docs/template/types.rst @@ -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