Skip to content

Commit c0db4cb

Browse files
authored
Documentation Improvements (#66)
1 parent 5af68c3 commit c0db4cb

File tree

10 files changed

+419
-350
lines changed

10 files changed

+419
-350
lines changed

compiler/docs/compiler.py

Lines changed: 281 additions & 279 deletions
Large diffs are not rendered by default.

compiler/docs/template/bound-methods.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ChatJoinRequest
128128
{chat_join_request_toctree}
129129

130130
Story
131-
---------------
131+
------
132132

133133
.. hlist::
134134
:columns: 2

compiler/docs/template/methods.rst

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ Utilities
4747

4848
.. currentmodule:: pyrogram.Client
4949

50+
Authorization
51+
-------------
52+
53+
.. autosummary::
54+
:nosignatures:
55+
56+
{authorization}
57+
58+
.. toctree::
59+
:hidden:
60+
61+
{authorization}
62+
5063
Messages
5164
--------
5265

@@ -73,31 +86,31 @@ Chats
7386

7487
{chats}
7588

76-
Chat Forum Topics
77-
-----
89+
Invite Links
90+
------------
7891

7992
.. autosummary::
8093
:nosignatures:
8194

82-
{chat_topics}
95+
{invite_links}
8396

8497
.. toctree::
8598
:hidden:
8699

87-
{chat_topics}
100+
{invite_links}
88101

89-
Telegram Business
90-
-------------
102+
Chat Forum Topics
103+
-----
91104

92105
.. autosummary::
93106
:nosignatures:
94107

95-
{business}
108+
{chat_topics}
96109

97110
.. toctree::
98111
:hidden:
99112

100-
{business}
113+
{chat_topics}
101114

102115
Users
103116
-----
@@ -112,19 +125,6 @@ Users
112125

113126
{users}
114127

115-
Invite Links
116-
------------
117-
118-
.. autosummary::
119-
:nosignatures:
120-
121-
{invite_links}
122-
123-
.. toctree::
124-
:hidden:
125-
126-
{invite_links}
127-
128128
Contacts
129129
--------
130130

@@ -138,83 +138,83 @@ Contacts
138138

139139
{contacts}
140140

141-
Stickers
141+
Password
142142
--------
143143

144144
.. autosummary::
145145
:nosignatures:
146146

147-
{stickers}
147+
{password}
148148

149149
.. toctree::
150150
:hidden:
151151

152-
{stickers}
152+
{password}
153153

154-
Stories
155-
--------
154+
Bots
155+
----
156156

157157
.. autosummary::
158158
:nosignatures:
159159

160-
{stories}
160+
{bots}
161161

162162
.. toctree::
163163
:hidden:
164164

165-
{stories}
165+
{bots}
166166

167-
Password
167+
Stickers
168168
--------
169169

170170
.. autosummary::
171171
:nosignatures:
172172

173-
{password}
173+
{stickers}
174174

175175
.. toctree::
176176
:hidden:
177177

178-
{password}
178+
{stickers}
179179

180-
Phone
180+
Stories
181181
--------
182182

183183
.. autosummary::
184184
:nosignatures:
185185

186-
{phone}
186+
{stories}
187187

188188
.. toctree::
189189
:hidden:
190190

191-
{phone}
191+
{stories}
192192

193-
Bots
194-
----
193+
Payments
194+
---------
195195

196196
.. autosummary::
197197
:nosignatures:
198198

199-
{bots}
199+
{payments}
200200

201201
.. toctree::
202202
:hidden:
203203

204-
{bots}
204+
{payments}
205205

206-
Authorization
207-
-------------
206+
Phone
207+
--------
208208

209209
.. autosummary::
210210
:nosignatures:
211211

212-
{authorization}
212+
{phone}
213213

214214
.. toctree::
215215
:hidden:
216216

217-
{authorization}
217+
{phone}
218218

219219
Advanced
220220
--------

compiler/docs/template/types.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ are only returned by other methods. You also don't need to import them, unless y
2121

2222
.. currentmodule:: pyrogram.types
2323

24-
Users & Chats
25-
-------------
24+
Messages & Media
25+
----------------
2626

2727
.. autosummary::
2828
:nosignatures:
2929

30-
{users_chats}
30+
{messages_media}
3131

3232
.. toctree::
3333
:hidden:
3434

35-
{users_chats}
35+
{messages_media}
3636

37-
Messages & Media
38-
----------------
37+
Users & Chats
38+
-------------
3939

4040
.. autosummary::
4141
:nosignatures:
4242

43-
{messages_media}
43+
{users_chats}
4444

4545
.. toctree::
4646
:hidden:
4747

48-
{messages_media}
48+
{users_chats}
4949

5050
Bot keyboards
5151
-------------
@@ -73,6 +73,19 @@ Bot commands
7373

7474
{bot_commands}
7575

76+
Chat Forum Topics
77+
------------------
78+
79+
.. autosummary::
80+
:nosignatures:
81+
82+
{chat_topics}
83+
84+
.. toctree::
85+
:hidden:
86+
87+
{chat_topics}
88+
7689
Input Media
7790
-----------
7891

@@ -138,28 +151,15 @@ Authorization
138151

139152
{authorization}
140153

141-
Chat Forum Topics
142-
------------------
143-
144-
.. autosummary::
145-
:nosignatures:
146-
147-
{chat_topics}
148-
149-
.. toctree::
150-
:hidden:
151-
152-
{chat_topics}
153-
154-
Telegram Business
155-
------------------
154+
Payments
155+
---------
156156

157157
.. autosummary::
158158
:nosignatures:
159159

160-
{business}
160+
{payments}
161161

162162
.. toctree::
163163
:hidden:
164164

165-
{business}
165+
{payments}

docs/source/.readthedocs.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
# You can also specify other tool versions:
14+
# nodejs: "19"
15+
# rust: "1.64"
16+
# golang: "1.19"
17+
jobs:
18+
post_checkout:
19+
# Cancel building pull requests when there aren't changed in the docs directory or YAML file.
20+
# You can add any other files or directories that you'd like here as well,
21+
# like your docs requirements file, or other files that will change your docs build.
22+
#
23+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
24+
# This is a special exit code on Read the Docs that will cancel the build immediately.
25+
- |
26+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/unknown_errors -- docs/;
27+
then
28+
exit 183;
29+
fi
30+
pre_build:
31+
- echo "Command run at 'pre_build' step"
32+
- python -m pip install httpx==0.27.0 lxml==5.2.2
33+
- curl -sL https://github.com/hydrogram/hydrogram/raw/013268c/dev_tools/generate_docs_json.py | python
34+
- ls -al compiler/api/
35+
- python -m pip install .
36+
- cd compiler/docs && python compiler.py && cd ../..
37+
- echo "Command run at 'pre_build' step"
38+
39+
# Build documentation in the "docs/" directory with Sphinx
40+
sphinx:
41+
configuration: docs/source/conf.py
42+
43+
# Optionally build your docs in additional formats such as PDF and ePub
44+
formats:
45+
- htmlzip
46+
47+
48+
# Optional but recommended, declare the Python requirements required
49+
# to build your documentation
50+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
51+
python:
52+
install:
53+
- requirements: docs/source/requirements.txt

docs/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,12 @@
135135
\setmonofont{Ubuntu Mono}
136136
"""
137137
}
138+
139+
# Set canonical URL from the Read the Docs Domain
140+
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
141+
142+
# Tell Jinja2 templates the build is running on Read the Docs
143+
if os.environ.get("READTHEDOCS", "") == "True":
144+
if "html_context" not in globals():
145+
html_context = {}
146+
html_context["READTHEDOCS"] = True

docs/source/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Sphinx<=7.2.6
2+
furo<=2023.9.10
3+
sphinx-autobuild<=2021.3.14
4+
sphinx-copybutton<=0.5.2
5+
pygments<=2.17.2

docs/source/static/css/all.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyrogram/enums/message_service_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class MessageServiceType(AutoName):
9393
CHAT_SHARED = auto()
9494
"Chat Shared"
9595

96-
AUTO_DELETE_TIMER_CHANGED = auto()
96+
MESSAGE_AUTO_DELETE_TIMER_CHANGED = auto()
9797
"Message Auto Delete Timer changed"
9898

9999
CHAT_BOOST_ADDED = auto()

pyrogram/types/messages_and_media/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ async def _parse(
845845
message_auto_delete_timer_changed = types.MessageAutoDeleteTimerChanged(
846846
message_auto_delete_time=action.period
847847
)
848-
service_type = enums.MessageServiceType.AUTO_DELETE_TIMER_CHANGED
848+
service_type = enums.MessageServiceType.MESSAGE_AUTO_DELETE_TIMER_CHANGED
849849
auto_setting_from = getattr(action, "auto_setting_from", None)
850850
if auto_setting_from:
851851
message_auto_delete_timer_changed.from_user = types.User._parse(

0 commit comments

Comments
 (0)