mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-01 23:05:15 +00:00
Docs revamp. Part 3
This commit is contained in:
7
docs/source/api/client.rst
Normal file
7
docs/source/api/client.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
Pyrogram Client
|
||||
===============
|
||||
|
||||
The :class:`Client <pyrogram.Client>` is the main class. It exposes easy-to-use methods that are named
|
||||
after the well established Telegram Bot API methods, thus offering a familiar look to Bot developers.
|
||||
|
||||
.. autoclass:: pyrogram.Client()
|
47
docs/source/api/decorators.rst
Normal file
47
docs/source/api/decorators.rst
Normal file
@@ -0,0 +1,47 @@
|
||||
Decorators
|
||||
==========
|
||||
|
||||
While still being methods bound to the :obj:`Client` class, decorators are of a special kind and thus deserve a
|
||||
dedicated page.
|
||||
|
||||
Decorators are able to register callback functions for handling updates in a much easier and cleaner way compared to
|
||||
`Handlers <Handlers.html>`_; they do so by instantiating the correct handler and calling
|
||||
:meth:`add_handler() <pyrogram.Client.add_handler>`, automatically. All you need to do is adding the decorators on top
|
||||
of your functions.
|
||||
|
||||
**Example:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client(...)
|
||||
|
||||
|
||||
@app.on_message()
|
||||
def log(client, message):
|
||||
print(message)
|
||||
|
||||
|
||||
app.run()
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
on_message
|
||||
on_callback_query
|
||||
on_inline_query
|
||||
on_deleted_messages
|
||||
on_user_status
|
||||
on_disconnect
|
||||
on_raw_update
|
||||
|
||||
.. automethod:: pyrogram.Client.on_message()
|
||||
.. automethod:: pyrogram.Client.on_callback_query()
|
||||
.. automethod:: pyrogram.Client.on_inline_query()
|
||||
.. automethod:: pyrogram.Client.on_deleted_messages()
|
||||
.. automethod:: pyrogram.Client.on_user_status()
|
||||
.. automethod:: pyrogram.Client.on_disconnect()
|
||||
.. automethod:: pyrogram.Client.on_raw_update()
|
28
docs/source/api/errors.rst
Normal file
28
docs/source/api/errors.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
RPC Errors
|
||||
==========
|
||||
|
||||
All the Pyrogram errors listed here live inside the ``errors`` sub-package.
|
||||
|
||||
**Example:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram.errors import RPCError
|
||||
|
||||
try:
|
||||
...
|
||||
except RPCError:
|
||||
...
|
||||
|
||||
.. autoexception:: pyrogram.RPCError()
|
||||
:members:
|
||||
|
||||
.. toctree::
|
||||
../errors/see-other
|
||||
../errors/bad-request
|
||||
../errors/unauthorized
|
||||
../errors/forbidden
|
||||
../errors/not-acceptable
|
||||
../errors/flood
|
||||
../errors/internal-server-error
|
||||
../errors/unknown-error
|
5
docs/source/api/filters.rst
Normal file
5
docs/source/api/filters.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
Update Filters
|
||||
==============
|
||||
|
||||
.. autoclass:: pyrogram.Filters
|
||||
:members:
|
60
docs/source/api/handlers.rst
Normal file
60
docs/source/api/handlers.rst
Normal file
@@ -0,0 +1,60 @@
|
||||
Update Handlers
|
||||
===============
|
||||
|
||||
Handlers are used to instruct Pyrogram about which kind of updates you'd like to handle with your callback functions.
|
||||
|
||||
For a much more convenient way of registering callback functions have a look at `Decorators <Decorators.html>`_ instead.
|
||||
In case you decided to manually create an handler, use :meth:`add_handler() <pyrogram.Client.add_handler>` to register
|
||||
it.
|
||||
|
||||
**Example:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client, MessageHandler
|
||||
|
||||
app = Client(...)
|
||||
|
||||
|
||||
def dump(client, message):
|
||||
print(message)
|
||||
|
||||
|
||||
app.add_handler(MessageHandler(dump))
|
||||
|
||||
app.run()
|
||||
|
||||
.. currentmodule:: pyrogram
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
MessageHandler
|
||||
DeletedMessagesHandler
|
||||
CallbackQueryHandler
|
||||
InlineQueryHandler
|
||||
UserStatusHandler
|
||||
DisconnectHandler
|
||||
RawUpdateHandler
|
||||
|
||||
.. autoclass:: MessageHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: DeletedMessagesHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: CallbackQueryHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InlineQueryHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: UserStatusHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: DisconnectHandler()
|
||||
:members:
|
||||
|
||||
.. autoclass:: RawUpdateHandler()
|
||||
:members:
|
||||
|
268
docs/source/api/methods.rst
Normal file
268
docs/source/api/methods.rst
Normal file
@@ -0,0 +1,268 @@
|
||||
Available Methods
|
||||
=================
|
||||
|
||||
All Pyrogram methods listed here are bound to a :obj:`Client <pyrogram.Client>` instance.
|
||||
|
||||
**Example:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client(...)
|
||||
|
||||
with app:
|
||||
app.send_message("haskell", "hi")
|
||||
|
||||
.. currentmodule:: pyrogram.Client
|
||||
|
||||
Utilities
|
||||
---------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
start
|
||||
stop
|
||||
restart
|
||||
idle
|
||||
run
|
||||
add_handler
|
||||
remove_handler
|
||||
send
|
||||
resolve_peer
|
||||
save_file
|
||||
stop_transmission
|
||||
|
||||
Messages
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
send_message
|
||||
forward_messages
|
||||
send_photo
|
||||
send_audio
|
||||
send_document
|
||||
send_sticker
|
||||
send_video
|
||||
send_animation
|
||||
send_voice
|
||||
send_video_note
|
||||
send_media_group
|
||||
send_location
|
||||
send_venue
|
||||
send_contact
|
||||
send_cached_media
|
||||
send_chat_action
|
||||
edit_message_text
|
||||
edit_message_caption
|
||||
edit_message_reply_markup
|
||||
edit_message_media
|
||||
delete_messages
|
||||
get_messages
|
||||
get_history
|
||||
get_history_count
|
||||
iter_history
|
||||
send_poll
|
||||
vote_poll
|
||||
stop_poll
|
||||
retract_vote
|
||||
download_media
|
||||
|
||||
Chats
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
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_preview
|
||||
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
|
||||
|
||||
Users
|
||||
-----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
get_me
|
||||
get_users
|
||||
get_user_profile_photos
|
||||
get_user_profile_photos_count
|
||||
set_user_profile_photo
|
||||
delete_user_profile_photos
|
||||
update_username
|
||||
|
||||
Contacts
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
add_contacts
|
||||
get_contacts
|
||||
get_contacts_count
|
||||
delete_contacts
|
||||
|
||||
Password
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
enable_cloud_password
|
||||
change_cloud_password
|
||||
remove_cloud_password
|
||||
|
||||
Bots
|
||||
----
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
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
|
||||
|
||||
.. Utilities
|
||||
---------
|
||||
|
||||
.. automethod:: pyrogram.Client.start()
|
||||
.. automethod:: pyrogram.Client.stop()
|
||||
.. automethod:: pyrogram.Client.restart()
|
||||
.. automethod:: pyrogram.Client.idle()
|
||||
.. automethod:: pyrogram.Client.run()
|
||||
.. automethod:: pyrogram.Client.add_handler()
|
||||
.. automethod:: pyrogram.Client.remove_handler()
|
||||
.. automethod:: pyrogram.Client.send()
|
||||
.. automethod:: pyrogram.Client.resolve_peer()
|
||||
.. automethod:: pyrogram.Client.save_file()
|
||||
.. automethod:: pyrogram.Client.stop_transmission()
|
||||
|
||||
.. Messages
|
||||
--------
|
||||
|
||||
.. automethod:: pyrogram.Client.send_message()
|
||||
.. automethod:: pyrogram.Client.forward_messages()
|
||||
.. automethod:: pyrogram.Client.send_photo()
|
||||
.. automethod:: pyrogram.Client.send_audio()
|
||||
.. automethod:: pyrogram.Client.send_document()
|
||||
.. automethod:: pyrogram.Client.send_sticker()
|
||||
.. automethod:: pyrogram.Client.send_video()
|
||||
.. automethod:: pyrogram.Client.send_animation()
|
||||
.. automethod:: pyrogram.Client.send_voice()
|
||||
.. automethod:: pyrogram.Client.send_video_note()
|
||||
.. automethod:: pyrogram.Client.send_media_group()
|
||||
.. automethod:: pyrogram.Client.send_location()
|
||||
.. automethod:: pyrogram.Client.send_venue()
|
||||
.. automethod:: pyrogram.Client.send_contact()
|
||||
.. automethod:: pyrogram.Client.send_cached_media()
|
||||
.. automethod:: pyrogram.Client.send_chat_action()
|
||||
.. automethod:: pyrogram.Client.edit_message_text()
|
||||
.. automethod:: pyrogram.Client.edit_message_caption()
|
||||
.. automethod:: pyrogram.Client.edit_message_reply_markup()
|
||||
.. automethod:: pyrogram.Client.edit_message_media()
|
||||
.. automethod:: pyrogram.Client.delete_messages()
|
||||
.. automethod:: pyrogram.Client.get_messages()
|
||||
.. automethod:: pyrogram.Client.get_history()
|
||||
.. automethod:: pyrogram.Client.get_history_count()
|
||||
.. automethod:: pyrogram.Client.iter_history()
|
||||
.. automethod:: pyrogram.Client.send_poll()
|
||||
.. automethod:: pyrogram.Client.vote_poll()
|
||||
.. automethod:: pyrogram.Client.stop_poll()
|
||||
.. automethod:: pyrogram.Client.retract_vote()
|
||||
.. automethod:: pyrogram.Client.download_media()
|
||||
|
||||
.. Chats
|
||||
-----
|
||||
|
||||
.. automethod:: pyrogram.Client.join_chat()
|
||||
.. automethod:: pyrogram.Client.leave_chat()
|
||||
.. automethod:: pyrogram.Client.kick_chat_member()
|
||||
.. automethod:: pyrogram.Client.unban_chat_member()
|
||||
.. automethod:: pyrogram.Client.restrict_chat_member()
|
||||
.. automethod:: pyrogram.Client.promote_chat_member()
|
||||
.. automethod:: pyrogram.Client.export_chat_invite_link()
|
||||
.. automethod:: pyrogram.Client.set_chat_photo()
|
||||
.. automethod:: pyrogram.Client.delete_chat_photo()
|
||||
.. automethod:: pyrogram.Client.set_chat_title()
|
||||
.. automethod:: pyrogram.Client.set_chat_description()
|
||||
.. automethod:: pyrogram.Client.pin_chat_message()
|
||||
.. automethod:: pyrogram.Client.unpin_chat_message()
|
||||
.. automethod:: pyrogram.Client.get_chat()
|
||||
.. automethod:: pyrogram.Client.get_chat_preview()
|
||||
.. automethod:: pyrogram.Client.get_chat_member()
|
||||
.. automethod:: pyrogram.Client.get_chat_members()
|
||||
.. automethod:: pyrogram.Client.get_chat_members_count()
|
||||
.. automethod:: pyrogram.Client.iter_chat_members()
|
||||
.. automethod:: pyrogram.Client.get_dialogs()
|
||||
.. automethod:: pyrogram.Client.iter_dialogs()
|
||||
.. automethod:: pyrogram.Client.get_dialogs_count()
|
||||
.. automethod:: pyrogram.Client.restrict_chat()
|
||||
.. automethod:: pyrogram.Client.update_chat_username()
|
||||
|
||||
.. Users
|
||||
-----
|
||||
|
||||
.. automethod:: pyrogram.Client.get_me()
|
||||
.. automethod:: pyrogram.Client.get_users()
|
||||
.. automethod:: pyrogram.Client.get_user_profile_photos()
|
||||
.. automethod:: pyrogram.Client.get_user_profile_photos_count()
|
||||
.. automethod:: pyrogram.Client.set_user_profile_photo()
|
||||
.. automethod:: pyrogram.Client.delete_user_profile_photos()
|
||||
.. automethod:: pyrogram.Client.update_username()
|
||||
|
||||
.. Contacts
|
||||
--------
|
||||
|
||||
.. automethod:: pyrogram.Client.add_contacts()
|
||||
.. automethod:: pyrogram.Client.get_contacts()
|
||||
.. automethod:: pyrogram.Client.get_contacts_count()
|
||||
.. automethod:: pyrogram.Client.delete_contacts()
|
||||
|
||||
.. Password
|
||||
--------
|
||||
|
||||
.. automethod:: pyrogram.Client.enable_cloud_password()
|
||||
.. automethod:: pyrogram.Client.change_cloud_password()
|
||||
.. automethod:: pyrogram.Client.remove_cloud_password()
|
||||
|
||||
.. Bots
|
||||
----
|
||||
|
||||
.. automethod:: pyrogram.Client.get_inline_bot_results()
|
||||
.. automethod:: pyrogram.Client.send_inline_bot_result()
|
||||
.. automethod:: pyrogram.Client.answer_callback_query()
|
||||
.. automethod:: pyrogram.Client.answer_inline_query()
|
||||
.. automethod:: pyrogram.Client.request_callback_answer()
|
||||
.. automethod:: pyrogram.Client.send_game()
|
||||
.. automethod:: pyrogram.Client.set_game_score()
|
||||
.. automethod:: pyrogram.Client.get_game_high_scores()
|
278
docs/source/api/types.rst
Normal file
278
docs/source/api/types.rst
Normal file
@@ -0,0 +1,278 @@
|
||||
Available Types
|
||||
===============
|
||||
|
||||
All Pyrogram types listed here are accessible through the main package directly.
|
||||
|
||||
**Example:**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
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:
|
||||
|
||||
User
|
||||
UserStatus
|
||||
Chat
|
||||
ChatPreview
|
||||
ChatPhoto
|
||||
ChatMember
|
||||
ChatMembers
|
||||
ChatPermissions
|
||||
Dialog
|
||||
Dialogs
|
||||
|
||||
Messages & Media
|
||||
----------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
Message
|
||||
Messages
|
||||
MessageEntity
|
||||
Photo
|
||||
PhotoSize
|
||||
UserProfilePhotos
|
||||
Audio
|
||||
Document
|
||||
Animation
|
||||
Video
|
||||
Voice
|
||||
VideoNote
|
||||
Contact
|
||||
Location
|
||||
Venue
|
||||
Sticker
|
||||
Game
|
||||
Poll
|
||||
PollOption
|
||||
|
||||
Keyboards
|
||||
---------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
ReplyKeyboardMarkup
|
||||
KeyboardButton
|
||||
ReplyKeyboardRemove
|
||||
InlineKeyboardMarkup
|
||||
InlineKeyboardButton
|
||||
ForceReply
|
||||
CallbackQuery
|
||||
GameHighScore
|
||||
CallbackGame
|
||||
|
||||
Input Media
|
||||
-----------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
InputMedia
|
||||
InputMediaPhoto
|
||||
InputMediaVideo
|
||||
InputMediaAudio
|
||||
InputMediaAnimation
|
||||
InputMediaDocument
|
||||
InputPhoneContact
|
||||
|
||||
Inline Mode
|
||||
------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
InlineQuery
|
||||
InlineQueryResult
|
||||
InlineQueryResultArticle
|
||||
|
||||
InputMessageContent
|
||||
-------------------
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
InputMessageContent
|
||||
InputTextMessageContent
|
||||
|
||||
.. User & Chats
|
||||
------------
|
||||
|
||||
.. autoclass:: User()
|
||||
:members:
|
||||
|
||||
.. autoclass:: UserStatus()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Chat()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ChatPreview()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ChatPhoto()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ChatMember()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ChatMembers()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ChatPermissions()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Dialog()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Dialogs()
|
||||
:members:
|
||||
|
||||
.. Messages & Media
|
||||
----------------
|
||||
|
||||
.. autoclass:: Message()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Messages()
|
||||
:members:
|
||||
|
||||
.. autoclass:: MessageEntity()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Photo()
|
||||
:members:
|
||||
|
||||
.. autoclass:: PhotoSize()
|
||||
:members:
|
||||
|
||||
.. autoclass:: UserProfilePhotos()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Audio()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Document()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Animation()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Video()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Voice()
|
||||
:members:
|
||||
|
||||
.. autoclass:: VideoNote()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Contact()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Location()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Venue()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Sticker()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Game()
|
||||
:members:
|
||||
|
||||
.. autoclass:: Poll()
|
||||
:members:
|
||||
|
||||
.. autoclass:: PollOption()
|
||||
:members:
|
||||
|
||||
.. Keyboards
|
||||
---------
|
||||
|
||||
.. autoclass:: ReplyKeyboardMarkup()
|
||||
:members:
|
||||
|
||||
.. autoclass:: KeyboardButton()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ReplyKeyboardRemove()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InlineKeyboardMarkup()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InlineKeyboardButton()
|
||||
:members:
|
||||
|
||||
.. autoclass:: ForceReply()
|
||||
:members:
|
||||
|
||||
.. autoclass:: CallbackQuery()
|
||||
:members:
|
||||
|
||||
.. autoclass:: GameHighScore()
|
||||
:members:
|
||||
|
||||
.. autoclass:: CallbackGame()
|
||||
:members:
|
||||
|
||||
.. Input Media
|
||||
-----------
|
||||
|
||||
.. autoclass:: InputMedia()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputMediaPhoto()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputMediaVideo()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputMediaAudio()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputMediaAnimation()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputMediaDocument()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputPhoneContact()
|
||||
:members:
|
||||
|
||||
|
||||
.. Inline Mode
|
||||
-----------
|
||||
|
||||
.. autoclass:: InlineQuery()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InlineQueryResult()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InlineQueryResultArticle()
|
||||
:members:
|
||||
|
||||
.. InputMessageContent
|
||||
-------------------
|
||||
|
||||
.. autoclass:: InputMessageContent()
|
||||
:members:
|
||||
|
||||
.. autoclass:: InputTextMessageContent()
|
||||
:members:
|
Reference in New Issue
Block a user