mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Move single methods, types and bound-methods to separated pages
The resulting pages were huge and were also taking a while to load This will improve docs navigation
This commit is contained in:
parent
ee2d5b1315
commit
efcf7d5503
@ -23,6 +23,7 @@ import shutil
|
||||
|
||||
HOME = "compiler/docs"
|
||||
DESTINATION = "docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "docs/source/api"
|
||||
|
||||
FUNCTIONS_PATH = "pyrogram/api/functions"
|
||||
TYPES_PATH = "pyrogram/api/types"
|
||||
@ -117,6 +118,352 @@ def generate(source_path, base):
|
||||
f.write("\n")
|
||||
|
||||
|
||||
def pyrogram_api():
|
||||
def get_title_list(s: str) -> list:
|
||||
return [i.strip() for i in [j.strip() for j in s.split("\n") if j] if i]
|
||||
|
||||
# Methods
|
||||
|
||||
categories = dict(
|
||||
utilities="""
|
||||
Utilities
|
||||
start
|
||||
stop
|
||||
restart
|
||||
idle
|
||||
run
|
||||
add_handler
|
||||
remove_handler
|
||||
stop_transmission
|
||||
export_session_string
|
||||
""",
|
||||
messages="""
|
||||
Messages
|
||||
send_message
|
||||
forward_messages
|
||||
send_photo
|
||||
send_audio
|
||||
send_document
|
||||
send_sticker
|
||||
send_animated_sticker
|
||||
send_video
|
||||
send_animation
|
||||
send_voice
|
||||
send_video_note
|
||||
send_media_group
|
||||
send_location
|
||||
send_venue
|
||||
send_contact
|
||||
send_cached_media
|
||||
edit_message_text
|
||||
edit_message_caption
|
||||
edit_message_media
|
||||
edit_message_reply_markup
|
||||
edit_inline_text
|
||||
edit_inline_caption
|
||||
edit_inline_media
|
||||
edit_inline_reply_markup
|
||||
send_chat_action
|
||||
delete_messages
|
||||
get_messages
|
||||
get_history
|
||||
get_history_count
|
||||
read_history
|
||||
iter_history
|
||||
send_poll
|
||||
vote_poll
|
||||
stop_poll
|
||||
retract_vote
|
||||
download_media
|
||||
""",
|
||||
chats="""
|
||||
Chats
|
||||
join_chat
|
||||
leave_chat
|
||||
kick_chat_member
|
||||
unban_chat_member
|
||||
restrict_chat_member
|
||||
promote_chat_member
|
||||
export_chat_invite_link
|
||||
set_chat_photo
|
||||
delete_chat_photo
|
||||
set_chat_title
|
||||
set_chat_description
|
||||
pin_chat_message
|
||||
unpin_chat_message
|
||||
get_chat
|
||||
get_chat_member
|
||||
get_chat_members
|
||||
get_chat_members_count
|
||||
iter_chat_members
|
||||
get_dialogs
|
||||
iter_dialogs
|
||||
get_dialogs_count
|
||||
restrict_chat
|
||||
update_chat_username
|
||||
archive_chats
|
||||
unarchive_chats
|
||||
""",
|
||||
users="""
|
||||
Users
|
||||
get_me
|
||||
get_users
|
||||
get_profile_photos
|
||||
get_profile_photos_count
|
||||
iter_profile_photos
|
||||
set_profile_photo
|
||||
delete_profile_photos
|
||||
update_username
|
||||
get_user_dc
|
||||
block_user
|
||||
unblock_user
|
||||
""",
|
||||
contacts="""
|
||||
Contacts
|
||||
add_contacts
|
||||
get_contacts
|
||||
get_contacts_count
|
||||
delete_contacts
|
||||
""",
|
||||
password="""
|
||||
Pssword
|
||||
enable_cloud_password
|
||||
change_cloud_password
|
||||
remove_cloud_password
|
||||
""",
|
||||
bots="""
|
||||
Bots
|
||||
get_inline_bot_results
|
||||
send_inline_bot_result
|
||||
answer_callback_query
|
||||
answer_inline_query
|
||||
request_callback_answer
|
||||
send_game
|
||||
set_game_score
|
||||
get_game_high_scores
|
||||
""",
|
||||
advanced="""
|
||||
Advanced
|
||||
send
|
||||
resolve_peer
|
||||
save_file
|
||||
"""
|
||||
)
|
||||
|
||||
root = PYROGRAM_API_DEST + "/methods"
|
||||
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
os.mkdir(root)
|
||||
|
||||
with open("template/methods.rst") as f:
|
||||
template = f.read()
|
||||
|
||||
with open(root + "/index.rst", "w") as f:
|
||||
fmt_keys = {}
|
||||
|
||||
for k, v in categories.items():
|
||||
name, *methods = get_title_list(v)
|
||||
fmt_keys.update({k: "\n ".join("{0} <{0}>".format(m) for m in methods)})
|
||||
|
||||
for method in methods:
|
||||
with open(root + "/{}.rst".format(method), "w") as f2:
|
||||
title = "{}()".format(method)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.Client.{}()".format(method))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
# Types
|
||||
|
||||
categories = dict(
|
||||
users_chats="""
|
||||
Users & Chats
|
||||
User
|
||||
UserStatus
|
||||
Chat
|
||||
ChatPreview
|
||||
ChatPhoto
|
||||
ChatMember
|
||||
ChatPermissions
|
||||
Dialog
|
||||
""",
|
||||
messages_media="""
|
||||
Messages & Media
|
||||
Message
|
||||
MessageEntity
|
||||
Photo
|
||||
Thumbnail
|
||||
Audio
|
||||
Document
|
||||
Animation
|
||||
Video
|
||||
Voice
|
||||
VideoNote
|
||||
Contact
|
||||
Location
|
||||
Venue
|
||||
Sticker
|
||||
Game
|
||||
WebPage
|
||||
Poll
|
||||
PollOption
|
||||
""",
|
||||
bots_keyboard="""
|
||||
Bots & Keyboards
|
||||
ReplyKeyboardMarkup
|
||||
KeyboardButton
|
||||
ReplyKeyboardRemove
|
||||
InlineKeyboardMarkup
|
||||
InlineKeyboardButton
|
||||
ForceReply
|
||||
CallbackQuery
|
||||
GameHighScore
|
||||
CallbackGame
|
||||
""",
|
||||
input_media="""
|
||||
Input Media
|
||||
InputMedia
|
||||
InputMediaPhoto
|
||||
InputMediaVideo
|
||||
InputMediaAudio
|
||||
InputMediaAnimation
|
||||
InputMediaDocument
|
||||
InputPhoneContact
|
||||
""",
|
||||
inline_mode="""
|
||||
Inline Mode
|
||||
InlineQuery
|
||||
InlineQueryResult
|
||||
InlineQueryResultArticle
|
||||
""",
|
||||
input_message_content="""
|
||||
InputMessageContent
|
||||
InputMessageContent
|
||||
InputTextMessageContent
|
||||
"""
|
||||
)
|
||||
|
||||
root = PYROGRAM_API_DEST + "/types"
|
||||
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
os.mkdir(root)
|
||||
|
||||
with open("template/types.rst") as f:
|
||||
template = f.read()
|
||||
|
||||
with open(root + "/index.rst", "w") as f:
|
||||
fmt_keys = {}
|
||||
|
||||
for k, v in categories.items():
|
||||
name, *types = get_title_list(v)
|
||||
|
||||
fmt_keys.update({k: "\n ".join(types)})
|
||||
|
||||
# noinspection PyShadowingBuiltins
|
||||
for type in types:
|
||||
with open(root + "/{}.rst".format(type), "w") as f2:
|
||||
title = "{}".format(type)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. autoclass:: pyrogram.{}()".format(type))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
# Bound Methods
|
||||
|
||||
categories = dict(
|
||||
message="""
|
||||
Message
|
||||
Message.click
|
||||
Message.delete
|
||||
Message.download
|
||||
Message.forward
|
||||
Message.pin
|
||||
Message.edit_text
|
||||
Message.edit_caption
|
||||
Message.edit_media
|
||||
Message.edit_reply_markup
|
||||
Message.reply_text
|
||||
Message.reply_animation
|
||||
Message.reply_audio
|
||||
Message.reply_cached_media
|
||||
Message.reply_chat_action
|
||||
Message.reply_contact
|
||||
Message.reply_document
|
||||
Message.reply_game
|
||||
Message.reply_inline_bot_result
|
||||
Message.reply_location
|
||||
Message.reply_media_group
|
||||
Message.reply_photo
|
||||
Message.reply_poll
|
||||
Message.reply_sticker
|
||||
Message.reply_venue
|
||||
Message.reply_video
|
||||
Message.reply_video_note
|
||||
Message.reply_voice
|
||||
""",
|
||||
chat="""
|
||||
Chat
|
||||
Chat.archive
|
||||
Chat.unarchive
|
||||
Chat.set_title
|
||||
Chat.set_description
|
||||
Chat.set_photo
|
||||
Chat.kick_member
|
||||
Chat.unban_member
|
||||
Chat.restrict_member
|
||||
Chat.promote_member
|
||||
""",
|
||||
user="""
|
||||
User
|
||||
User.archive
|
||||
User.unarchive
|
||||
""",
|
||||
callback_query="""
|
||||
Callback Query
|
||||
CallbackQuery.answer
|
||||
CallbackQuery.edit_message_text
|
||||
CallbackQuery.edit_message_caption
|
||||
CallbackQuery.edit_message_media
|
||||
CallbackQuery.edit_message_reply_markup
|
||||
""",
|
||||
inline_query="""
|
||||
InlineQuery
|
||||
InlineQuery.answer
|
||||
"""
|
||||
)
|
||||
|
||||
root = PYROGRAM_API_DEST + "/bound-methods"
|
||||
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
os.mkdir(root)
|
||||
|
||||
with open("template/bound-methods.rst") as f:
|
||||
template = f.read()
|
||||
|
||||
with open(root + "/index.rst", "w") as f:
|
||||
fmt_keys = {}
|
||||
|
||||
for k, v in categories.items():
|
||||
name, *bound_methods = get_title_list(v)
|
||||
|
||||
fmt_keys.update({"{}_hlist".format(k): "\n ".join("- :meth:`~{}`".format(bm) for bm in bound_methods)})
|
||||
|
||||
fmt_keys.update(
|
||||
{"{}_toctree".format(k): "\n ".join("{} <{}>".format(bm.split(".")[1], bm) for bm in bound_methods)})
|
||||
|
||||
# noinspection PyShadowingBuiltins
|
||||
for bm in bound_methods:
|
||||
with open(root + "/{}.rst".format(bm), "w") as f2:
|
||||
title = "{}()".format(bm)
|
||||
|
||||
f2.write(title + "\n" + "=" * len(title) + "\n\n")
|
||||
f2.write(".. automethod:: pyrogram.{}()".format(bm))
|
||||
|
||||
f.write(template.format(**fmt_keys))
|
||||
|
||||
|
||||
def start():
|
||||
global page_template
|
||||
global toctree
|
||||
@ -131,6 +478,7 @@ def start():
|
||||
|
||||
generate(TYPES_PATH, TYPES_BASE)
|
||||
generate(FUNCTIONS_PATH, FUNCTIONS_BASE)
|
||||
pyrogram_api()
|
||||
|
||||
|
||||
if "__main__" == __name__:
|
||||
@ -138,5 +486,6 @@ if "__main__" == __name__:
|
||||
TYPES_PATH = "../../pyrogram/api/types"
|
||||
HOME = "."
|
||||
DESTINATION = "../../docs/source/telegram"
|
||||
PYROGRAM_API_DEST = "../../docs/source/api"
|
||||
|
||||
start()
|
||||
|
88
compiler/docs/template/bound-methods.rst
vendored
Normal file
88
compiler/docs/template/bound-methods.rst
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
Bound Methods
|
||||
=============
|
||||
|
||||
Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a class which are
|
||||
accessed via an instance of that class. They make it even easier to call specific methods by automatically inferring
|
||||
some of the required arguments.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 8
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
||||
@app.on_message()
|
||||
def hello(client, message)
|
||||
message.reply("hi")
|
||||
|
||||
|
||||
app.run()
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
Message
|
||||
-------
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
{message_hlist}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{message_toctree}
|
||||
|
||||
Chat
|
||||
----
|
||||
|
||||
.. hlist::
|
||||
:columns: 4
|
||||
|
||||
{chat_hlist}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{chat_toctree}
|
||||
|
||||
User
|
||||
----
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
{user_hlist}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{user_toctree}
|
||||
|
||||
CallbackQuery
|
||||
-------------
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
{callback_query_hlist}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{callback_query_toctree}
|
||||
|
||||
InlineQuery
|
||||
-----------
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
{inline_query_hlist}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{inline_query_toctree}
|
122
compiler/docs/template/methods.rst
vendored
Normal file
122
compiler/docs/template/methods.rst
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
Available Methods
|
||||
=================
|
||||
|
||||
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 6
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
with app:
|
||||
app.send_message("haskell", "hi")
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
|
||||
Utilities
|
||||
---------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{utilities}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{utilities}
|
||||
|
||||
Messages
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{messages}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{messages}
|
||||
|
||||
Chats
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{chats}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{chats}
|
||||
|
||||
Users
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{users}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{users}
|
||||
|
||||
Contacts
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{contacts}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{contacts}
|
||||
|
||||
Password
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{password}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{password}
|
||||
|
||||
Bots
|
||||
----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{bots}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{bots}
|
||||
|
||||
Advanced
|
||||
--------
|
||||
|
||||
Learn more about these methods at :doc:`Advanced Usage <../../topics/advanced-usage>`.
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{advanced}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{advanced}
|
95
compiler/docs/template/types.rst
vendored
Normal file
95
compiler/docs/template/types.rst
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
Available Types
|
||||
===============
|
||||
|
||||
This page is about Pyrogram types. All types listed here are accessible through the main package directly.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 1
|
||||
|
||||
from pyrogram import User, Message, ...
|
||||
|
||||
.. 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()``.
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
|
||||
Users & Chats
|
||||
-------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{users_chats}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{users_chats}
|
||||
|
||||
Messages & Media
|
||||
----------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{messages_media}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{messages_media}
|
||||
|
||||
Bots & Keyboards
|
||||
----------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{bots_keyboard}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{bots_keyboard}
|
||||
|
||||
Input Media
|
||||
-----------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{input_media}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{input_media}
|
||||
|
||||
Inline Mode
|
||||
-----------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{inline_mode}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{inline_mode}
|
||||
|
||||
InputMessageContent
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
{input_message_content}
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
{input_message_content}
|
@ -1,164 +0,0 @@
|
||||
Bound Methods
|
||||
=============
|
||||
|
||||
Some Pyrogram types define what are called bound methods. Bound methods are functions attached to a class which are
|
||||
accessed via an instance of that class. They make it even easier to call specific methods by automatically inferring
|
||||
some of the required arguments.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 8
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
|
||||
@app.on_message()
|
||||
def hello(client, message)
|
||||
message.reply("hi")
|
||||
|
||||
|
||||
app.run()
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
Index
|
||||
-----
|
||||
|
||||
Message
|
||||
^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Message.click`
|
||||
- :meth:`~Message.delete`
|
||||
- :meth:`~Message.download`
|
||||
- :meth:`~Message.forward`
|
||||
- :meth:`~Message.pin`
|
||||
- :meth:`~Message.edit_text`
|
||||
- :meth:`~Message.edit_caption`
|
||||
- :meth:`~Message.edit_media`
|
||||
- :meth:`~Message.edit_reply_markup`
|
||||
- :meth:`~Message.reply_text`
|
||||
- :meth:`~Message.reply_animation`
|
||||
- :meth:`~Message.reply_audio`
|
||||
- :meth:`~Message.reply_cached_media`
|
||||
- :meth:`~Message.reply_chat_action`
|
||||
- :meth:`~Message.reply_contact`
|
||||
- :meth:`~Message.reply_document`
|
||||
- :meth:`~Message.reply_game`
|
||||
- :meth:`~Message.reply_inline_bot_result`
|
||||
- :meth:`~Message.reply_location`
|
||||
- :meth:`~Message.reply_media_group`
|
||||
- :meth:`~Message.reply_photo`
|
||||
- :meth:`~Message.reply_poll`
|
||||
- :meth:`~Message.reply_sticker`
|
||||
- :meth:`~Message.reply_venue`
|
||||
- :meth:`~Message.reply_video`
|
||||
- :meth:`~Message.reply_video_note`
|
||||
- :meth:`~Message.reply_voice`
|
||||
|
||||
Chat
|
||||
^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
- :meth:`~Chat.archive`
|
||||
- :meth:`~Chat.unarchive`
|
||||
- :meth:`~Chat.set_title`
|
||||
- :meth:`~Chat.set_description`
|
||||
- :meth:`~Chat.set_photo`
|
||||
- :meth:`~Chat.kick_member`
|
||||
- :meth:`~Chat.unban_member`
|
||||
- :meth:`~Chat.restrict_member`
|
||||
- :meth:`~Chat.promote_member`
|
||||
|
||||
User
|
||||
^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
- :meth:`~User.archive`
|
||||
- :meth:`~User.unarchive`
|
||||
|
||||
CallbackQuery
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~CallbackQuery.answer`
|
||||
- :meth:`~CallbackQuery.edit_message_text`
|
||||
- :meth:`~CallbackQuery.edit_message_caption`
|
||||
- :meth:`~CallbackQuery.edit_message_media`
|
||||
- :meth:`~CallbackQuery.edit_message_reply_markup`
|
||||
|
||||
InlineQuery
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 2
|
||||
|
||||
- :meth:`~InlineQuery.answer`
|
||||
|
||||
-----
|
||||
|
||||
Details
|
||||
-------
|
||||
|
||||
.. Message
|
||||
.. automethod:: Message.click()
|
||||
.. automethod:: Message.delete()
|
||||
.. automethod:: Message.download()
|
||||
.. automethod:: Message.forward()
|
||||
.. automethod:: Message.pin()
|
||||
.. automethod:: Message.edit_text()
|
||||
.. automethod:: Message.edit_caption()
|
||||
.. automethod:: Message.edit_media()
|
||||
.. automethod:: Message.edit_reply_markup()
|
||||
.. automethod:: Message.reply_text()
|
||||
.. automethod:: Message.reply_animation()
|
||||
.. automethod:: Message.reply_audio()
|
||||
.. automethod:: Message.reply_cached_media()
|
||||
.. automethod:: Message.reply_chat_action()
|
||||
.. automethod:: Message.reply_contact()
|
||||
.. automethod:: Message.reply_document()
|
||||
.. automethod:: Message.reply_game()
|
||||
.. automethod:: Message.reply_inline_bot_result()
|
||||
.. automethod:: Message.reply_location()
|
||||
.. automethod:: Message.reply_media_group()
|
||||
.. automethod:: Message.reply_photo()
|
||||
.. automethod:: Message.reply_poll()
|
||||
.. automethod:: Message.reply_sticker()
|
||||
.. automethod:: Message.reply_venue()
|
||||
.. automethod:: Message.reply_video()
|
||||
.. automethod:: Message.reply_video_note()
|
||||
.. automethod:: Message.reply_voice()
|
||||
|
||||
.. Chat
|
||||
.. automethod:: Chat.archive()
|
||||
.. automethod:: Chat.unarchive()
|
||||
.. automethod:: Chat.set_title()
|
||||
.. automethod:: Chat.set_description()
|
||||
.. automethod:: Chat.set_photo()
|
||||
.. automethod:: Chat.kick_member()
|
||||
.. automethod:: Chat.unban_member()
|
||||
.. automethod:: Chat.restrict_member()
|
||||
.. automethod:: Chat.promote_member()
|
||||
|
||||
.. User
|
||||
.. automethod:: User.archive()
|
||||
.. automethod:: User.unarchive()
|
||||
|
||||
.. CallbackQuery
|
||||
.. automethod:: CallbackQuery.answer()
|
||||
.. automethod:: CallbackQuery.edit_message_text()
|
||||
.. automethod:: CallbackQuery.edit_message_caption()
|
||||
.. automethod:: CallbackQuery.edit_message_media()
|
||||
.. automethod:: CallbackQuery.edit_message_reply_markup()
|
||||
|
||||
.. InlineQuery
|
||||
.. automethod:: InlineQuery.answer()
|
@ -1,296 +0,0 @@
|
||||
Available Methods
|
||||
=================
|
||||
|
||||
This page is about Pyrogram methods. All the methods listed here are bound to a :class:`~pyrogram.Client` instance.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 6
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client("my_account")
|
||||
|
||||
with app:
|
||||
app.send_message("haskell", "hi")
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
Index
|
||||
-----
|
||||
|
||||
Utilities
|
||||
^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 4
|
||||
|
||||
- :meth:`~Client.start`
|
||||
- :meth:`~Client.stop`
|
||||
- :meth:`~Client.restart`
|
||||
- :meth:`~Client.idle`
|
||||
- :meth:`~Client.run`
|
||||
- :meth:`~Client.add_handler`
|
||||
- :meth:`~Client.remove_handler`
|
||||
- :meth:`~Client.stop_transmission`
|
||||
- :meth:`~Client.export_session_string`
|
||||
|
||||
Messages
|
||||
^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.send_message`
|
||||
- :meth:`~Client.forward_messages`
|
||||
- :meth:`~Client.send_photo`
|
||||
- :meth:`~Client.send_audio`
|
||||
- :meth:`~Client.send_document`
|
||||
- :meth:`~Client.send_sticker`
|
||||
- :meth:`~Client.send_animated_sticker`
|
||||
- :meth:`~Client.send_video`
|
||||
- :meth:`~Client.send_animation`
|
||||
- :meth:`~Client.send_voice`
|
||||
- :meth:`~Client.send_video_note`
|
||||
- :meth:`~Client.send_media_group`
|
||||
- :meth:`~Client.send_location`
|
||||
- :meth:`~Client.send_venue`
|
||||
- :meth:`~Client.send_contact`
|
||||
- :meth:`~Client.send_cached_media`
|
||||
- :meth:`~Client.edit_message_text`
|
||||
- :meth:`~Client.edit_message_caption`
|
||||
- :meth:`~Client.edit_message_media`
|
||||
- :meth:`~Client.edit_message_reply_markup`
|
||||
- :meth:`~Client.edit_inline_text`
|
||||
- :meth:`~Client.edit_inline_caption`
|
||||
- :meth:`~Client.edit_inline_media`
|
||||
- :meth:`~Client.edit_inline_reply_markup`
|
||||
- :meth:`~Client.send_chat_action`
|
||||
- :meth:`~Client.delete_messages`
|
||||
- :meth:`~Client.get_messages`
|
||||
- :meth:`~Client.get_history`
|
||||
- :meth:`~Client.get_history_count`
|
||||
- :meth:`~Client.read_history`
|
||||
- :meth:`~Client.iter_history`
|
||||
- :meth:`~Client.send_poll`
|
||||
- :meth:`~Client.vote_poll`
|
||||
- :meth:`~Client.stop_poll`
|
||||
- :meth:`~Client.retract_vote`
|
||||
- :meth:`~Client.download_media`
|
||||
|
||||
Chats
|
||||
^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.join_chat`
|
||||
- :meth:`~Client.leave_chat`
|
||||
- :meth:`~Client.kick_chat_member`
|
||||
- :meth:`~Client.unban_chat_member`
|
||||
- :meth:`~Client.restrict_chat_member`
|
||||
- :meth:`~Client.promote_chat_member`
|
||||
- :meth:`~Client.export_chat_invite_link`
|
||||
- :meth:`~Client.set_chat_photo`
|
||||
- :meth:`~Client.delete_chat_photo`
|
||||
- :meth:`~Client.set_chat_title`
|
||||
- :meth:`~Client.set_chat_description`
|
||||
- :meth:`~Client.pin_chat_message`
|
||||
- :meth:`~Client.unpin_chat_message`
|
||||
- :meth:`~Client.get_chat`
|
||||
- :meth:`~Client.get_chat_member`
|
||||
- :meth:`~Client.get_chat_members`
|
||||
- :meth:`~Client.get_chat_members_count`
|
||||
- :meth:`~Client.iter_chat_members`
|
||||
- :meth:`~Client.get_dialogs`
|
||||
- :meth:`~Client.iter_dialogs`
|
||||
- :meth:`~Client.get_dialogs_count`
|
||||
- :meth:`~Client.restrict_chat`
|
||||
- :meth:`~Client.update_chat_username`
|
||||
- :meth:`~Client.archive_chats`
|
||||
- :meth:`~Client.unarchive_chats`
|
||||
|
||||
Users
|
||||
^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.get_me`
|
||||
- :meth:`~Client.get_users`
|
||||
- :meth:`~Client.get_profile_photos`
|
||||
- :meth:`~Client.get_profile_photos_count`
|
||||
- :meth:`~Client.iter_profile_photos`
|
||||
- :meth:`~Client.set_profile_photo`
|
||||
- :meth:`~Client.delete_profile_photos`
|
||||
- :meth:`~Client.update_username`
|
||||
- :meth:`~Client.get_user_dc`
|
||||
- :meth:`~Client.block_user`
|
||||
- :meth:`~Client.unblock_user`
|
||||
|
||||
Contacts
|
||||
^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.add_contacts`
|
||||
- :meth:`~Client.get_contacts`
|
||||
- :meth:`~Client.get_contacts_count`
|
||||
- :meth:`~Client.delete_contacts`
|
||||
|
||||
Password
|
||||
^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.enable_cloud_password`
|
||||
- :meth:`~Client.change_cloud_password`
|
||||
- :meth:`~Client.remove_cloud_password`
|
||||
|
||||
Bots
|
||||
^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :meth:`~Client.get_inline_bot_results`
|
||||
- :meth:`~Client.send_inline_bot_result`
|
||||
- :meth:`~Client.answer_callback_query`
|
||||
- :meth:`~Client.answer_inline_query`
|
||||
- :meth:`~Client.request_callback_answer`
|
||||
- :meth:`~Client.send_game`
|
||||
- :meth:`~Client.set_game_score`
|
||||
- :meth:`~Client.get_game_high_scores`
|
||||
|
||||
Advanced Usage (Raw API)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Learn more about these methods at :doc:`Advanced Usage <../topics/advanced-usage>`.
|
||||
|
||||
.. hlist::
|
||||
:columns: 4
|
||||
|
||||
- :meth:`~Client.send`
|
||||
- :meth:`~Client.resolve_peer`
|
||||
- :meth:`~Client.save_file`
|
||||
|
||||
-----
|
||||
|
||||
Details
|
||||
-------
|
||||
|
||||
.. Utilities
|
||||
.. automethod:: Client.start()
|
||||
.. automethod:: Client.stop()
|
||||
.. automethod:: Client.restart()
|
||||
.. automethod:: Client.idle()
|
||||
.. automethod:: Client.run()
|
||||
.. automethod:: Client.add_handler()
|
||||
.. automethod:: Client.remove_handler()
|
||||
.. automethod:: Client.stop_transmission()
|
||||
.. automethod:: Client.export_session_string()
|
||||
|
||||
.. Messages
|
||||
.. automethod:: Client.send_message()
|
||||
.. automethod:: Client.forward_messages()
|
||||
.. automethod:: Client.send_photo()
|
||||
.. automethod:: Client.send_audio()
|
||||
.. automethod:: Client.send_document()
|
||||
.. automethod:: Client.send_sticker()
|
||||
.. automethod:: Client.send_animated_sticker()
|
||||
.. automethod:: Client.send_video()
|
||||
.. automethod:: Client.send_animation()
|
||||
.. automethod:: Client.send_voice()
|
||||
.. automethod:: Client.send_video_note()
|
||||
.. automethod:: Client.send_media_group()
|
||||
.. automethod:: Client.send_location()
|
||||
.. automethod:: Client.send_venue()
|
||||
.. automethod:: Client.send_contact()
|
||||
.. automethod:: Client.send_cached_media()
|
||||
.. automethod:: Client.send_chat_action()
|
||||
.. automethod:: Client.edit_message_text()
|
||||
.. automethod:: Client.edit_message_caption()
|
||||
.. automethod:: Client.edit_message_media()
|
||||
.. automethod:: Client.edit_message_reply_markup()
|
||||
.. automethod:: Client.edit_inline_text()
|
||||
.. automethod:: Client.edit_inline_caption()
|
||||
.. automethod:: Client.edit_inline_media()
|
||||
.. automethod:: Client.edit_inline_reply_markup()
|
||||
.. automethod:: Client.delete_messages()
|
||||
.. automethod:: Client.get_messages()
|
||||
.. automethod:: Client.get_history()
|
||||
.. automethod:: Client.get_history_count()
|
||||
.. automethod:: Client.read_history()
|
||||
.. automethod:: Client.iter_history()
|
||||
.. automethod:: Client.send_poll()
|
||||
.. automethod:: Client.vote_poll()
|
||||
.. automethod:: Client.stop_poll()
|
||||
.. automethod:: Client.retract_vote()
|
||||
.. automethod:: Client.download_media()
|
||||
|
||||
.. Chats
|
||||
.. automethod:: Client.join_chat()
|
||||
.. automethod:: Client.leave_chat()
|
||||
.. automethod:: Client.kick_chat_member()
|
||||
.. automethod:: Client.unban_chat_member()
|
||||
.. automethod:: Client.restrict_chat_member()
|
||||
.. automethod:: Client.promote_chat_member()
|
||||
.. automethod:: Client.export_chat_invite_link()
|
||||
.. automethod:: Client.set_chat_photo()
|
||||
.. automethod:: Client.delete_chat_photo()
|
||||
.. automethod:: Client.set_chat_title()
|
||||
.. automethod:: Client.set_chat_description()
|
||||
.. automethod:: Client.pin_chat_message()
|
||||
.. automethod:: Client.unpin_chat_message()
|
||||
.. automethod:: Client.get_chat()
|
||||
.. automethod:: Client.get_chat_member()
|
||||
.. automethod:: Client.get_chat_members()
|
||||
.. automethod:: Client.get_chat_members_count()
|
||||
.. automethod:: Client.iter_chat_members()
|
||||
.. automethod:: Client.get_dialogs()
|
||||
.. automethod:: Client.iter_dialogs()
|
||||
.. automethod:: Client.get_dialogs_count()
|
||||
.. automethod:: Client.restrict_chat()
|
||||
.. automethod:: Client.update_chat_username()
|
||||
.. automethod:: Client.archive_chats()
|
||||
.. automethod:: Client.unarchive_chats()
|
||||
|
||||
.. Users
|
||||
.. automethod:: Client.get_me()
|
||||
.. automethod:: Client.get_users()
|
||||
.. automethod:: Client.get_profile_photos()
|
||||
.. automethod:: Client.get_profile_photos_count()
|
||||
.. automethod:: Client.iter_profile_photos()
|
||||
.. automethod:: Client.set_profile_photo()
|
||||
.. automethod:: Client.delete_profile_photos()
|
||||
.. automethod:: Client.update_username()
|
||||
.. automethod:: Client.get_user_dc()
|
||||
.. automethod:: Client.block_user()
|
||||
.. automethod:: Client.unblock_user()
|
||||
|
||||
.. Contacts
|
||||
.. automethod:: Client.add_contacts()
|
||||
.. automethod:: Client.get_contacts()
|
||||
.. automethod:: Client.get_contacts_count()
|
||||
.. automethod:: Client.delete_contacts()
|
||||
|
||||
.. Password
|
||||
.. automethod:: Client.enable_cloud_password()
|
||||
.. automethod:: Client.change_cloud_password()
|
||||
.. automethod:: Client.remove_cloud_password()
|
||||
|
||||
.. Bots
|
||||
.. automethod:: Client.get_inline_bot_results()
|
||||
.. automethod:: Client.send_inline_bot_result()
|
||||
.. automethod:: Client.answer_callback_query()
|
||||
.. automethod:: Client.answer_inline_query()
|
||||
.. automethod:: Client.request_callback_answer()
|
||||
.. automethod:: Client.send_game()
|
||||
.. automethod:: Client.set_game_score()
|
||||
.. automethod:: Client.get_game_high_scores()
|
||||
|
||||
.. Advanced Usage
|
||||
.. automethod:: Client.send()
|
||||
.. automethod:: Client.resolve_peer()
|
||||
.. automethod:: Client.save_file()
|
@ -1,172 +0,0 @@
|
||||
Available Types
|
||||
===============
|
||||
|
||||
This page is about Pyrogram types. All types listed here are accessible through the main package directly.
|
||||
|
||||
.. code-block:: python
|
||||
:emphasize-lines: 1
|
||||
|
||||
from pyrogram import User, Message, ...
|
||||
|
||||
.. 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()``.
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
Index
|
||||
-----
|
||||
|
||||
Users & Chats
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 5
|
||||
|
||||
- :class:`User`
|
||||
- :class:`UserStatus`
|
||||
- :class:`Chat`
|
||||
- :class:`ChatPreview`
|
||||
- :class:`ChatPhoto`
|
||||
- :class:`ChatMember`
|
||||
- :class:`ChatPermissions`
|
||||
- :class:`Dialog`
|
||||
|
||||
Messages & Media
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 5
|
||||
|
||||
- :class:`Message`
|
||||
- :class:`MessageEntity`
|
||||
- :class:`Photo`
|
||||
- :class:`Thumbnail`
|
||||
- :class:`Audio`
|
||||
- :class:`Document`
|
||||
- :class:`Animation`
|
||||
- :class:`Video`
|
||||
- :class:`Voice`
|
||||
- :class:`VideoNote`
|
||||
- :class:`Contact`
|
||||
- :class:`Location`
|
||||
- :class:`Venue`
|
||||
- :class:`Sticker`
|
||||
- :class:`Game`
|
||||
- :class:`WebPage`
|
||||
- :class:`Poll`
|
||||
- :class:`PollOption`
|
||||
|
||||
Bots & Keyboards
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 4
|
||||
|
||||
- :class:`ReplyKeyboardMarkup`
|
||||
- :class:`KeyboardButton`
|
||||
- :class:`ReplyKeyboardRemove`
|
||||
- :class:`InlineKeyboardMarkup`
|
||||
- :class:`InlineKeyboardButton`
|
||||
- :class:`ForceReply`
|
||||
- :class:`CallbackQuery`
|
||||
- :class:`GameHighScore`
|
||||
- :class:`CallbackGame`
|
||||
|
||||
Input Media
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 4
|
||||
|
||||
- :class:`InputMedia`
|
||||
- :class:`InputMediaPhoto`
|
||||
- :class:`InputMediaVideo`
|
||||
- :class:`InputMediaAudio`
|
||||
- :class:`InputMediaAnimation`
|
||||
- :class:`InputMediaDocument`
|
||||
- :class:`InputPhoneContact`
|
||||
|
||||
Inline Mode
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :class:`InlineQuery`
|
||||
- :class:`InlineQueryResult`
|
||||
- :class:`InlineQueryResultArticle`
|
||||
|
||||
InputMessageContent
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. hlist::
|
||||
:columns: 3
|
||||
|
||||
- :class:`InputMessageContent`
|
||||
- :class:`InputTextMessageContent`
|
||||
|
||||
-----
|
||||
|
||||
Details
|
||||
-------
|
||||
|
||||
.. User & Chats
|
||||
.. autoclass:: User()
|
||||
.. autoclass:: UserStatus()
|
||||
.. autoclass:: Chat()
|
||||
.. autoclass:: ChatPreview()
|
||||
.. autoclass:: ChatPhoto()
|
||||
.. autoclass:: ChatMember()
|
||||
.. autoclass:: ChatPermissions()
|
||||
.. autoclass:: Dialog()
|
||||
|
||||
.. Messages & Media
|
||||
.. autoclass:: Message()
|
||||
.. autoclass:: MessageEntity()
|
||||
.. autoclass:: Photo()
|
||||
.. autoclass:: Thumbnail()
|
||||
.. autoclass:: Audio()
|
||||
.. autoclass:: Document()
|
||||
.. autoclass:: Animation()
|
||||
.. autoclass:: Video()
|
||||
.. autoclass:: Voice()
|
||||
.. autoclass:: VideoNote()
|
||||
.. autoclass:: Contact()
|
||||
.. autoclass:: Location()
|
||||
.. autoclass:: Venue()
|
||||
.. autoclass:: Sticker()
|
||||
.. autoclass:: Game()
|
||||
.. autoclass:: WebPage()
|
||||
.. autoclass:: Poll()
|
||||
.. autoclass:: PollOption()
|
||||
|
||||
.. Bots & Keyboards
|
||||
.. autoclass:: ReplyKeyboardMarkup()
|
||||
.. autoclass:: KeyboardButton()
|
||||
.. autoclass:: ReplyKeyboardRemove()
|
||||
.. autoclass:: InlineKeyboardMarkup()
|
||||
.. autoclass:: InlineKeyboardButton()
|
||||
.. autoclass:: ForceReply()
|
||||
.. autoclass:: CallbackQuery()
|
||||
.. autoclass:: GameHighScore()
|
||||
.. autoclass:: CallbackGame()
|
||||
|
||||
.. Input Media
|
||||
.. autoclass:: InputMedia()
|
||||
.. autoclass:: InputMediaPhoto()
|
||||
.. autoclass:: InputMediaVideo()
|
||||
.. autoclass:: InputMediaAudio()
|
||||
.. autoclass:: InputMediaAnimation()
|
||||
.. autoclass:: InputMediaDocument()
|
||||
.. autoclass:: InputPhoneContact()
|
||||
|
||||
.. Inline Mode
|
||||
.. autoclass:: InlineQuery()
|
||||
.. autoclass:: InlineQueryResult()
|
||||
.. autoclass:: InlineQueryResultArticle()
|
||||
|
||||
.. InputMessageContent
|
||||
.. autoclass:: InputMessageContent()
|
||||
.. autoclass:: InputTextMessageContent()
|
@ -23,9 +23,9 @@ Welcome to Pyrogram
|
||||
:caption: API Reference
|
||||
|
||||
api/client
|
||||
api/methods
|
||||
api/types
|
||||
api/bound-methods
|
||||
api/methods/index
|
||||
api/types/index
|
||||
api/bound-methods/index
|
||||
api/handlers
|
||||
api/decorators
|
||||
api/errors
|
||||
|
7
setup.py
7
setup.py
@ -40,7 +40,11 @@ with open("README.md", encoding="utf-8") as f:
|
||||
class Clean(Command):
|
||||
DIST = ["./build", "./dist", "./Pyrogram.egg-info"]
|
||||
API = ["pyrogram/api/errors/exceptions", "pyrogram/api/functions", "pyrogram/api/types", "pyrogram/api/all.py"]
|
||||
DOCS = ["docs/source/telegram", "docs/build"]
|
||||
DOCS = [
|
||||
"docs/source/telegram", "docs/build", "docs/source/api/methods", "docs/source/api/types",
|
||||
"docs/source/api/bound-methods"
|
||||
]
|
||||
|
||||
ALL = DIST + API + DOCS
|
||||
|
||||
description = "Clean generated files"
|
||||
@ -122,7 +126,6 @@ class Generate(Command):
|
||||
if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]:
|
||||
api_compiler.start()
|
||||
error_compiler.start()
|
||||
docs_compiler.start()
|
||||
|
||||
setup(
|
||||
name="Pyrogram",
|
||||
|
Loading…
Reference in New Issue
Block a user