File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Available 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
You can’t perform that action at this time.
0 commit comments