mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-02 15:25:41 +00:00
Revamp docs about the main Pyrogram package
This commit is contained in:
@@ -328,15 +328,16 @@ def start():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if docstring_args:
|
if docstring_args:
|
||||||
docstring_args = "Args:\n " + "\n ".join(docstring_args)
|
docstring_args = "Parameters:\n " + "\n ".join(docstring_args)
|
||||||
else:
|
else:
|
||||||
docstring_args = "No parameters required."
|
docstring_args = "No parameters required."
|
||||||
|
|
||||||
docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args
|
docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args
|
||||||
|
|
||||||
if c.section == "functions":
|
if c.section == "functions":
|
||||||
docstring_args += "\n\n Raises:\n :obj:`RPCError <pyrogram.RPCError>`"
|
|
||||||
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
|
docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type)
|
||||||
|
docstring_args += "\n\n Raises:\n RPCError: In case of a Telegram RPC error."
|
||||||
|
|
||||||
else:
|
else:
|
||||||
references = get_references(".".join(filter(None, [c.namespace, c.name])))
|
references = get_references(".".join(filter(None, [c.namespace, c.name])))
|
||||||
|
|
||||||
|
@@ -44,6 +44,8 @@ extensions = [
|
|||||||
'sphinx.ext.autosummary'
|
'sphinx.ext.autosummary'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
napoleon_use_rtype = False
|
||||||
|
|
||||||
# Don't show source files on docs
|
# Don't show source files on docs
|
||||||
html_show_sourcelink = True
|
html_show_sourcelink = True
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ html_theme = 'sphinx_rtd_theme'
|
|||||||
#
|
#
|
||||||
html_theme_options = {
|
html_theme_options = {
|
||||||
'canonical_url': "https://docs.pyrogram.ml/",
|
'canonical_url': "https://docs.pyrogram.ml/",
|
||||||
'collapse_navigation': False,
|
'collapse_navigation': True,
|
||||||
'sticky_navigation': False,
|
'sticky_navigation': False,
|
||||||
'logo_only': True,
|
'logo_only': True,
|
||||||
'display_version': True
|
'display_version': True
|
||||||
|
@@ -1,162 +0,0 @@
|
|||||||
Client
|
|
||||||
======
|
|
||||||
|
|
||||||
.. currentmodule:: pyrogram.Client
|
|
||||||
|
|
||||||
.. autoclass:: pyrogram.Client
|
|
||||||
|
|
||||||
Utilities
|
|
||||||
---------
|
|
||||||
|
|
||||||
.. autosummary::
|
|
||||||
:nosignatures:
|
|
||||||
|
|
||||||
start
|
|
||||||
stop
|
|
||||||
restart
|
|
||||||
idle
|
|
||||||
run
|
|
||||||
add_handler
|
|
||||||
remove_handler
|
|
||||||
send
|
|
||||||
resolve_peer
|
|
||||||
save_file
|
|
||||||
stop_transmission
|
|
||||||
|
|
||||||
Decorators
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. autosummary::
|
|
||||||
:nosignatures:
|
|
||||||
|
|
||||||
on_message
|
|
||||||
on_callback_query
|
|
||||||
on_inline_query
|
|
||||||
on_deleted_messages
|
|
||||||
on_user_status
|
|
||||||
on_disconnect
|
|
||||||
on_raw_update
|
|
||||||
|
|
||||||
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
|
|
||||||
answer_inline_query
|
|
||||||
|
|
||||||
|
|
||||||
.. autoclass:: pyrogram.Client
|
|
||||||
:inherited-members:
|
|
||||||
:members:
|
|
47
docs/source/pyrogram/Decorators.rst
Normal file
47
docs/source/pyrogram/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/pyrogram/Errors.rst
Normal file
28
docs/source/pyrogram/Errors.rst
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
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/SeeOther
|
||||||
|
../errors/BadRequest
|
||||||
|
../errors/Unauthorized
|
||||||
|
../errors/Forbidden
|
||||||
|
../errors/NotAcceptable
|
||||||
|
../errors/Flood
|
||||||
|
../errors/InternalServerError
|
||||||
|
../errors/UnknownError
|
@@ -1,6 +1,29 @@
|
|||||||
Handlers
|
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
|
.. currentmodule:: pyrogram
|
||||||
|
|
||||||
.. autosummary::
|
.. autosummary::
|
||||||
@@ -14,24 +37,24 @@ Handlers
|
|||||||
DisconnectHandler
|
DisconnectHandler
|
||||||
RawUpdateHandler
|
RawUpdateHandler
|
||||||
|
|
||||||
.. autoclass:: MessageHandler
|
.. autoclass:: MessageHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: DeletedMessagesHandler
|
.. autoclass:: DeletedMessagesHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: CallbackQueryHandler
|
.. autoclass:: CallbackQueryHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InlineQueryHandler
|
.. autoclass:: InlineQueryHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: UserStatusHandler
|
.. autoclass:: UserStatusHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: DisconnectHandler
|
.. autoclass:: DisconnectHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: RawUpdateHandler
|
.. autoclass:: RawUpdateHandler()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
270
docs/source/pyrogram/Methods.rst
Normal file
270
docs/source/pyrogram/Methods.rst
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
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
|
||||||
|
answer_inline_query
|
||||||
|
|
||||||
|
.. 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()
|
||||||
|
.. automethod:: pyrogram.Client.answer_inline_query()
|
@@ -1,6 +0,0 @@
|
|||||||
ParseMode
|
|
||||||
=========
|
|
||||||
|
|
||||||
.. autoclass:: pyrogram.ParseMode
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
@@ -1,15 +0,0 @@
|
|||||||
RPCError
|
|
||||||
========
|
|
||||||
|
|
||||||
.. autoexception:: pyrogram.RPCError
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
../errors/SeeOther
|
|
||||||
../errors/BadRequest
|
|
||||||
../errors/Unauthorized
|
|
||||||
../errors/Forbidden
|
|
||||||
../errors/NotAcceptable
|
|
||||||
../errors/Flood
|
|
||||||
../errors/InternalServerError
|
|
||||||
../errors/UnknownError
|
|
@@ -1,6 +1,19 @@
|
|||||||
Types
|
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
|
.. currentmodule:: pyrogram
|
||||||
|
|
||||||
Users & Chats
|
Users & Chats
|
||||||
@@ -42,11 +55,12 @@ Messages & Media
|
|||||||
Location
|
Location
|
||||||
Venue
|
Venue
|
||||||
Sticker
|
Sticker
|
||||||
|
Game
|
||||||
Poll
|
Poll
|
||||||
PollOption
|
PollOption
|
||||||
|
|
||||||
Bots
|
Keyboards
|
||||||
----
|
---------
|
||||||
|
|
||||||
.. autosummary::
|
.. autosummary::
|
||||||
:nosignatures:
|
:nosignatures:
|
||||||
@@ -58,7 +72,8 @@ Bots
|
|||||||
InlineKeyboardButton
|
InlineKeyboardButton
|
||||||
ForceReply
|
ForceReply
|
||||||
CallbackQuery
|
CallbackQuery
|
||||||
Game
|
GameHighScore
|
||||||
|
CallbackGame
|
||||||
|
|
||||||
Input Media
|
Input Media
|
||||||
-----------
|
-----------
|
||||||
@@ -96,168 +111,168 @@ InputMessageContent
|
|||||||
.. User & Chats
|
.. User & Chats
|
||||||
------------
|
------------
|
||||||
|
|
||||||
.. autoclass:: User
|
.. autoclass:: User()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: UserStatus
|
.. autoclass:: UserStatus()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Chat
|
.. autoclass:: Chat()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ChatPreview
|
.. autoclass:: ChatPreview()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ChatPhoto
|
.. autoclass:: ChatPhoto()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ChatMember
|
.. autoclass:: ChatMember()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ChatMembers
|
.. autoclass:: ChatMembers()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ChatPermissions
|
.. autoclass:: ChatPermissions()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Dialog
|
.. autoclass:: Dialog()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Dialogs
|
.. autoclass:: Dialogs()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. Messages & Media
|
.. Messages & Media
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
.. autoclass:: Message
|
.. autoclass:: Message()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Messages
|
.. autoclass:: Messages()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: MessageEntity
|
.. autoclass:: MessageEntity()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Photo
|
.. autoclass:: Photo()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: PhotoSize
|
.. autoclass:: PhotoSize()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: UserProfilePhotos
|
.. autoclass:: UserProfilePhotos()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Audio
|
.. autoclass:: Audio()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Document
|
.. autoclass:: Document()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Animation
|
.. autoclass:: Animation()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Video
|
.. autoclass:: Video()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Voice
|
.. autoclass:: Voice()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: VideoNote
|
.. autoclass:: VideoNote()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Contact
|
.. autoclass:: Contact()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Location
|
.. autoclass:: Location()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Venue
|
.. autoclass:: Venue()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Sticker
|
.. autoclass:: Sticker()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Poll
|
.. autoclass:: Game()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: PollOption
|
.. autoclass:: Poll()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. Bots
|
.. autoclass:: PollOption()
|
||||||
----
|
|
||||||
|
|
||||||
.. autoclass:: ReplyKeyboardMarkup
|
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: KeyboardButton
|
.. Keyboards
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. autoclass:: ReplyKeyboardMarkup()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ReplyKeyboardRemove
|
.. autoclass:: KeyboardButton()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InlineKeyboardMarkup
|
.. autoclass:: ReplyKeyboardRemove()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InlineKeyboardButton
|
.. autoclass:: InlineKeyboardMarkup()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: ForceReply
|
.. autoclass:: InlineKeyboardButton()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: CallbackQuery
|
.. autoclass:: ForceReply()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: Game
|
.. autoclass:: CallbackQuery()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: GameHighScore
|
.. autoclass:: GameHighScore()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: GameHighScores
|
.. autoclass:: CallbackGame()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. Input Media
|
.. Input Media
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
.. autoclass:: InputMedia
|
.. autoclass:: InputMedia()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputMediaPhoto
|
.. autoclass:: InputMediaPhoto()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputMediaVideo
|
.. autoclass:: InputMediaVideo()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputMediaAudio
|
.. autoclass:: InputMediaAudio()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputMediaAnimation
|
.. autoclass:: InputMediaAnimation()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputMediaDocument
|
.. autoclass:: InputMediaDocument()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputPhoneContact
|
.. autoclass:: InputPhoneContact()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
|
||||||
.. Inline Mode
|
.. Inline Mode
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
.. autoclass:: InlineQuery
|
.. autoclass:: InlineQuery()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InlineQueryResult
|
.. autoclass:: InlineQueryResult()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InlineQueryResultArticle
|
.. autoclass:: InlineQueryResultArticle()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. InputMessageContent
|
.. InputMessageContent
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
.. autoclass:: InputMessageContent
|
.. autoclass:: InputMessageContent()
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
.. autoclass:: InputTextMessageContent
|
.. autoclass:: InputTextMessageContent()
|
||||||
:members:
|
:members:
|
||||||
|
@@ -4,17 +4,18 @@ Pyrogram
|
|||||||
In this section you can find a detailed description of the Pyrogram package and its API.
|
In this section you can find a detailed description of the Pyrogram package and its API.
|
||||||
|
|
||||||
:class:`Client <pyrogram.Client>` is the main class. It exposes easy-to-use methods that are named
|
: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.
|
after the well established Telegram Bot API methods, thus offering a familiar look to Bot developers.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
Client
|
|
||||||
Types
|
Types
|
||||||
|
Methods
|
||||||
Handlers
|
Handlers
|
||||||
|
Decorators
|
||||||
Filters
|
Filters
|
||||||
ChatAction
|
ChatAction
|
||||||
ParseMode
|
Errors
|
||||||
RPCError
|
|
||||||
|
|
||||||
.. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods
|
|
||||||
|
.. autoclass:: pyrogram.Client()
|
||||||
|
@@ -64,7 +64,7 @@ class Client(Methods, BaseClient):
|
|||||||
It exposes bot-like methods for an easy access to the API as well as a simple way to
|
It exposes bot-like methods for an easy access to the API as well as a simple way to
|
||||||
invoke every single Telegram API method available.
|
invoke every single Telegram API method available.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
session_name (``str``):
|
session_name (``str``):
|
||||||
Name to uniquely identify a session of either a User or a Bot, e.g.: "my_account". This name will be used
|
Name to uniquely identify a session of either a User or a Bot, e.g.: "my_account". This name will be used
|
||||||
to save a file to disk that stores details needed for reconnecting without asking again for credentials.
|
to save a file to disk that stores details needed for reconnecting without asking again for credentials.
|
||||||
@@ -264,8 +264,8 @@ class Client(Methods, BaseClient):
|
|||||||
"""Use this method to start the Client.
|
"""Use this method to start the Client.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ConnectionError`` in case you try to start an already started Client.
|
ConnectionError: In case you try to start an already started Client.
|
||||||
"""
|
"""
|
||||||
if self.is_started:
|
if self.is_started:
|
||||||
raise ConnectionError("Client has already been started")
|
raise ConnectionError("Client has already been started")
|
||||||
@@ -357,7 +357,7 @@ class Client(Methods, BaseClient):
|
|||||||
"""Use this method to stop the Client.
|
"""Use this method to stop the Client.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
``ConnectionError`` in case you try to stop an already stopped Client.
|
ConnectionError: In case you try to stop an already stopped Client.
|
||||||
"""
|
"""
|
||||||
if not self.is_started:
|
if not self.is_started:
|
||||||
raise ConnectionError("Client is already stopped")
|
raise ConnectionError("Client is already stopped")
|
||||||
@@ -399,7 +399,7 @@ class Client(Methods, BaseClient):
|
|||||||
"""Use this method to restart the Client.
|
"""Use this method to restart the Client.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
``ConnectionError`` in case you try to restart a stopped Client.
|
ConnectionError: In case you try to restart a stopped Client.
|
||||||
"""
|
"""
|
||||||
self.stop()
|
self.stop()
|
||||||
self.start()
|
self.start()
|
||||||
@@ -416,7 +416,7 @@ class Client(Methods, BaseClient):
|
|||||||
the main script; calling idle() will ensure the client(s) will be kept alive by not letting the main script to
|
the main script; calling idle() will ensure the client(s) will be kept alive by not letting the main script to
|
||||||
end, until you decide to quit.
|
end, until you decide to quit.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
stop_signals (``tuple``, *optional*):
|
stop_signals (``tuple``, *optional*):
|
||||||
Iterable containing signals the signal handler will listen to.
|
Iterable containing signals the signal handler will listen to.
|
||||||
Defaults to (SIGINT, SIGTERM, SIGABRT).
|
Defaults to (SIGINT, SIGTERM, SIGABRT).
|
||||||
@@ -445,7 +445,7 @@ class Client(Methods, BaseClient):
|
|||||||
since :meth:`idle` will block.
|
since :meth:`idle` will block.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
self.start()
|
self.start()
|
||||||
self.idle()
|
self.idle()
|
||||||
@@ -457,7 +457,7 @@ class Client(Methods, BaseClient):
|
|||||||
will be used for a single update. To handle the same update more than once, register
|
will be used for a single update. To handle the same update more than once, register
|
||||||
your handler using a different group id (lower group id == higher priority).
|
your handler using a different group id (lower group id == higher priority).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
handler (``Handler``):
|
handler (``Handler``):
|
||||||
The handler to be registered.
|
The handler to be registered.
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ class Client(Methods, BaseClient):
|
|||||||
The group identifier, defaults to 0.
|
The group identifier, defaults to 0.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A tuple of (handler, group)
|
``tuple``: A tuple consisting of (handler, group).
|
||||||
"""
|
"""
|
||||||
if isinstance(handler, DisconnectHandler):
|
if isinstance(handler, DisconnectHandler):
|
||||||
self.disconnect_handler = handler.callback
|
self.disconnect_handler = handler.callback
|
||||||
@@ -481,7 +481,7 @@ class Client(Methods, BaseClient):
|
|||||||
the return value of the :meth:`add_handler` method, a tuple of (handler, group), and
|
the return value of the :meth:`add_handler` method, a tuple of (handler, group), and
|
||||||
pass it directly.
|
pass it directly.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
handler (``Handler``):
|
handler (``Handler``):
|
||||||
The handler to be removed.
|
The handler to be removed.
|
||||||
|
|
||||||
@@ -1048,8 +1048,8 @@ class Client(Methods, BaseClient):
|
|||||||
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
||||||
available yet in the Client class as an easy-to-use method).
|
available yet in the Client class as an easy-to-use method).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
data (``Object``):
|
data (``RawFunction``):
|
||||||
The API Schema function filled with proper arguments.
|
The API Schema function filled with proper arguments.
|
||||||
|
|
||||||
retries (``int``):
|
retries (``int``):
|
||||||
@@ -1058,8 +1058,11 @@ class Client(Methods, BaseClient):
|
|||||||
timeout (``float``):
|
timeout (``float``):
|
||||||
Timeout in seconds.
|
Timeout in seconds.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``RawType``: The raw type response generated by the query.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
if not self.is_started:
|
if not self.is_started:
|
||||||
raise ConnectionError("Client has not been started")
|
raise ConnectionError("Client has not been started")
|
||||||
@@ -1347,17 +1350,17 @@ class Client(Methods, BaseClient):
|
|||||||
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
||||||
available yet in the Client class as an easy-to-use method).
|
available yet in the Client class as an easy-to-use method).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
peer_id (``int`` | ``str``):
|
peer_id (``int`` | ``str``):
|
||||||
The peer id you want to extract the InputPeer from.
|
The peer id you want to extract the InputPeer from.
|
||||||
Can be a direct id (int), a username (str) or a phone number (str).
|
Can be a direct id (int), a username (str) or a phone number (str).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the resolved peer id is returned in form of an InputPeer object.
|
``InputPeer``: On success, the resolved peer id is returned in form of an InputPeer object.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``KeyError`` in case the peer doesn't exist in the internal database.
|
KeyError: In case the peer doesn't exist in the internal database.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return self.peers_by_id[peer_id]
|
return self.peers_by_id[peer_id]
|
||||||
@@ -1429,7 +1432,7 @@ class Client(Methods, BaseClient):
|
|||||||
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
:obj:`functions <pyrogram.api.functions>` (i.e: a Telegram API method you wish to use which is not
|
||||||
available yet in the Client class as an easy-to-use method).
|
available yet in the Client class as an easy-to-use method).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
path (``str``):
|
path (``str``):
|
||||||
The path of the file you want to upload that exists on your local machine.
|
The path of the file you want to upload that exists on your local machine.
|
||||||
|
|
||||||
@@ -1449,7 +1452,7 @@ class Client(Methods, BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -1463,10 +1466,10 @@ class Client(Methods, BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the uploaded file is returned in form of an InputFile object.
|
``InputFile``: On success, the uploaded file is returned in form of an InputFile object.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
part_size = 512 * 1024
|
part_size = 512 * 1024
|
||||||
file_size = os.path.getsize(path)
|
file_size = os.path.getsize(path)
|
||||||
|
@@ -27,7 +27,7 @@ def create(name: str, func: callable, **kwargs) -> type:
|
|||||||
|
|
||||||
Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
|
Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
name (``str``):
|
name (``str``):
|
||||||
Your filter's name. Can be anything you like.
|
Your filter's name. Can be anything you like.
|
||||||
|
|
||||||
@@ -35,9 +35,9 @@ def create(name: str, func: callable, **kwargs) -> type:
|
|||||||
A function that accepts two arguments *(filter, update)* and returns a Boolean: True if the update should be
|
A function that accepts two arguments *(filter, update)* and returns a Boolean: True if the update should be
|
||||||
handled, False otherwise.
|
handled, False otherwise.
|
||||||
The "update" argument type will vary depending on which `Handler <Handlers.html>`_ is coming from.
|
The "update" argument type will vary depending on which `Handler <Handlers.html>`_ is coming from.
|
||||||
For example, in a :obj:`MessageHandler <pyrogram.MessageHandler>` the update type will be
|
For example, in a :obj:`MessageHandler` the update type will be
|
||||||
a :obj:`Message <pyrogram.Message>`; in a :obj:`CallbackQueryHandler <pyrogram.CallbackQueryHandler>` the
|
a :obj:`Message`; in a :obj:`CallbackQueryHandler` the
|
||||||
update type will be a :obj:`CallbackQuery <pyrogram.CallbackQuery>`. Your function body can then access the
|
update type will be a :obj:`CallbackQuery`. Your function body can then access the
|
||||||
incoming update and decide whether to allow it or not.
|
incoming update and decide whether to allow it or not.
|
||||||
|
|
||||||
**kwargs (``any``, *optional*):
|
**kwargs (``any``, *optional*):
|
||||||
@@ -54,7 +54,7 @@ def create(name: str, func: callable, **kwargs) -> type:
|
|||||||
class Filters:
|
class Filters:
|
||||||
"""This class provides access to all library-defined Filters available in Pyrogram.
|
"""This class provides access to all library-defined Filters available in Pyrogram.
|
||||||
|
|
||||||
The Filters listed here are intended to be used with the :obj:`MessageHandler <pyrogram.MessageHandler>` only.
|
The Filters listed here are intended to be used with the :obj:`MessageHandler` only.
|
||||||
At the moment, if you want to filter updates coming from different `Handlers <Handlers.html>`_ you have to create
|
At the moment, if you want to filter updates coming from different `Handlers <Handlers.html>`_ you have to create
|
||||||
your own filters with :meth:`Filters.create` and use them in the same way.
|
your own filters with :meth:`Filters.create` and use them in the same way.
|
||||||
"""
|
"""
|
||||||
@@ -89,49 +89,49 @@ class Filters:
|
|||||||
"""Filter edited messages."""
|
"""Filter edited messages."""
|
||||||
|
|
||||||
audio = create("Audio", lambda _, m: bool(m.audio))
|
audio = create("Audio", lambda _, m: bool(m.audio))
|
||||||
"""Filter messages that contain :obj:`Audio <pyrogram.Audio>` objects."""
|
"""Filter messages that contain :obj:`Audio` objects."""
|
||||||
|
|
||||||
document = create("Document", lambda _, m: bool(m.document))
|
document = create("Document", lambda _, m: bool(m.document))
|
||||||
"""Filter messages that contain :obj:`Document <pyrogram.Document>` objects."""
|
"""Filter messages that contain :obj:`Document` objects."""
|
||||||
|
|
||||||
photo = create("Photo", lambda _, m: bool(m.photo))
|
photo = create("Photo", lambda _, m: bool(m.photo))
|
||||||
"""Filter messages that contain :obj:`Photo <pyrogram.PhotoSize>` objects."""
|
"""Filter messages that contain :obj:`Photo` objects."""
|
||||||
|
|
||||||
sticker = create("Sticker", lambda _, m: bool(m.sticker))
|
sticker = create("Sticker", lambda _, m: bool(m.sticker))
|
||||||
"""Filter messages that contain :obj:`Sticker <pyrogram.Sticker>` objects."""
|
"""Filter messages that contain :obj:`Sticker` objects."""
|
||||||
|
|
||||||
animation = create("Animation", lambda _, m: bool(m.animation))
|
animation = create("Animation", lambda _, m: bool(m.animation))
|
||||||
"""Filter messages that contain :obj:`Animation <pyrogram.Animation>` objects."""
|
"""Filter messages that contain :obj:`Animation` objects."""
|
||||||
|
|
||||||
game = create("Game", lambda _, m: bool(m.game))
|
game = create("Game", lambda _, m: bool(m.game))
|
||||||
"""Filter messages that contain :obj:`Game <pyrogram.Game>` objects."""
|
"""Filter messages that contain :obj:`Game` objects."""
|
||||||
|
|
||||||
video = create("Video", lambda _, m: bool(m.video))
|
video = create("Video", lambda _, m: bool(m.video))
|
||||||
"""Filter messages that contain :obj:`Video <pyrogram.Video>` objects."""
|
"""Filter messages that contain :obj:`Video` objects."""
|
||||||
|
|
||||||
media_group = create("MediaGroup", lambda _, m: bool(m.media_group_id))
|
media_group = create("MediaGroup", lambda _, m: bool(m.media_group_id))
|
||||||
"""Filter messages containing photos or videos being part of an album."""
|
"""Filter messages containing photos or videos being part of an album."""
|
||||||
|
|
||||||
voice = create("Voice", lambda _, m: bool(m.voice))
|
voice = create("Voice", lambda _, m: bool(m.voice))
|
||||||
"""Filter messages that contain :obj:`Voice <pyrogram.Voice>` note objects."""
|
"""Filter messages that contain :obj:`Voice` note objects."""
|
||||||
|
|
||||||
video_note = create("VideoNote", lambda _, m: bool(m.video_note))
|
video_note = create("VideoNote", lambda _, m: bool(m.video_note))
|
||||||
"""Filter messages that contain :obj:`VideoNote <pyrogram.VideoNote>` objects."""
|
"""Filter messages that contain :obj:`VideoNote` objects."""
|
||||||
|
|
||||||
contact = create("Contact", lambda _, m: bool(m.contact))
|
contact = create("Contact", lambda _, m: bool(m.contact))
|
||||||
"""Filter messages that contain :obj:`Contact <pyrogram.Contact>` objects."""
|
"""Filter messages that contain :obj:`Contact` objects."""
|
||||||
|
|
||||||
location = create("Location", lambda _, m: bool(m.location))
|
location = create("Location", lambda _, m: bool(m.location))
|
||||||
"""Filter messages that contain :obj:`Location <pyrogram.Location>` objects."""
|
"""Filter messages that contain :obj:`Location` objects."""
|
||||||
|
|
||||||
venue = create("Venue", lambda _, m: bool(m.venue))
|
venue = create("Venue", lambda _, m: bool(m.venue))
|
||||||
"""Filter messages that contain :obj:`Venue <pyrogram.Venue>` objects."""
|
"""Filter messages that contain :obj:`Venue` objects."""
|
||||||
|
|
||||||
web_page = create("WebPage", lambda _, m: m.web_page)
|
web_page = create("WebPage", lambda _, m: m.web_page)
|
||||||
"""Filter messages sent with a webpage preview."""
|
"""Filter messages sent with a webpage preview."""
|
||||||
|
|
||||||
poll = create("Poll", lambda _, m: m.poll)
|
poll = create("Poll", lambda _, m: m.poll)
|
||||||
"""Filter messages that contain :obj:`Poll <pyrogram.Poll>` objects."""
|
"""Filter messages that contain :obj:`Poll` objects."""
|
||||||
|
|
||||||
private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private"))
|
private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private"))
|
||||||
"""Filter messages sent in private chats."""
|
"""Filter messages sent in private chats."""
|
||||||
@@ -230,12 +230,12 @@ class Filters:
|
|||||||
):
|
):
|
||||||
"""Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
|
"""Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
commands (``str`` | ``list``):
|
commands (``str`` | ``list``):
|
||||||
The command or list of commands as string the filter should look for.
|
The command or list of commands as string the filter should look for.
|
||||||
Examples: "start", ["start", "help", "settings"]. When a message text containing
|
Examples: "start", ["start", "help", "settings"]. When a message text containing
|
||||||
a command arrives, the command itself and its arguments will be stored in the *command*
|
a command arrives, the command itself and its arguments will be stored in the *command*
|
||||||
field of the :class:`Message <pyrogram.Message>`.
|
field of the :class:`Message`.
|
||||||
|
|
||||||
prefix (``str`` | ``list``, *optional*):
|
prefix (``str`` | ``list``, *optional*):
|
||||||
A prefix or a list of prefixes as string the filter should look for.
|
A prefix or a list of prefixes as string the filter should look for.
|
||||||
@@ -275,11 +275,11 @@ class Filters:
|
|||||||
def regex(pattern, flags: int = 0):
|
def regex(pattern, flags: int = 0):
|
||||||
"""Filter messages that match a given RegEx pattern.
|
"""Filter messages that match a given RegEx pattern.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
pattern (``str``):
|
pattern (``str``):
|
||||||
The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
|
The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches,
|
||||||
all the `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_
|
all the `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_
|
||||||
are stored in the *matches* field of the :class:`Message <pyrogram.Message>` itself.
|
are stored in the *matches* field of the :class:`Message` itself.
|
||||||
|
|
||||||
flags (``int``, *optional*):
|
flags (``int``, *optional*):
|
||||||
RegEx flags.
|
RegEx flags.
|
||||||
@@ -298,7 +298,7 @@ class Filters:
|
|||||||
You can use `set bound methods <https://docs.python.org/3/library/stdtypes.html#set>`_ to manipulate the
|
You can use `set bound methods <https://docs.python.org/3/library/stdtypes.html#set>`_ to manipulate the
|
||||||
users container.
|
users container.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
users (``int`` | ``str`` | ``list``):
|
users (``int`` | ``str`` | ``list``):
|
||||||
Pass one or more user ids/usernames to filter users.
|
Pass one or more user ids/usernames to filter users.
|
||||||
For you yourself, "me" or "self" can be used as well.
|
For you yourself, "me" or "self" can be used as well.
|
||||||
@@ -329,7 +329,7 @@ class Filters:
|
|||||||
You can use `set bound methods <https://docs.python.org/3/library/stdtypes.html#set>`_ to manipulate the
|
You can use `set bound methods <https://docs.python.org/3/library/stdtypes.html#set>`_ to manipulate the
|
||||||
chats container.
|
chats container.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chats (``int`` | ``str`` | ``list``):
|
chats (``int`` | ``str`` | ``list``):
|
||||||
Pass one or more chat ids/usernames to filter chats.
|
Pass one or more chat ids/usernames to filter chats.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
|
@@ -26,17 +26,17 @@ class CallbackQueryHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_callback_query() <pyrogram.Client.on_callback_query>` decorator.
|
:meth:`on_callback_query() <pyrogram.Client.on_callback_query>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a new CallbackQuery arrives. It takes *(client, callback_query)*
|
Pass a function that will be called when a new CallbackQuery arrives. It takes *(client, callback_query)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of callback queries to be passed
|
Pass one or more filters to allow only a subset of callback queries to be passed
|
||||||
in your callback function.
|
in your callback function.
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the message handler.
|
The Client itself, useful when you want to call other API methods inside the message handler.
|
||||||
|
|
||||||
callback_query (:obj:`CallbackQuery <pyrogram.CallbackQuery>`):
|
callback_query (:obj:`CallbackQuery <pyrogram.CallbackQuery>`):
|
||||||
|
@@ -27,20 +27,20 @@ class DeletedMessagesHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_deleted_messages() <pyrogram.Client.on_deleted_messages>` decorator.
|
:meth:`on_deleted_messages() <pyrogram.Client.on_deleted_messages>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when one or more Messages have been deleted.
|
Pass a function that will be called when one or more Messages have been deleted.
|
||||||
It takes *(client, messages)* as positional arguments (look at the section below for a detailed description).
|
It takes *(client, messages)* as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of messages to be passed
|
Pass one or more filters to allow only a subset of messages to be passed
|
||||||
in your callback function.
|
in your callback function.
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the message handler.
|
The Client itself, useful when you want to call other API methods inside the message handler.
|
||||||
|
|
||||||
messages (:obj:`Messages <pyrogram.Messages>`):
|
messages (:obj:`Messages`):
|
||||||
The deleted messages.
|
The deleted messages.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -26,13 +26,13 @@ class DisconnectHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_disconnect() <pyrogram.Client.on_disconnect>` decorator.
|
:meth:`on_disconnect() <pyrogram.Client.on_disconnect>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a disconnection occurs. It takes *(client)*
|
Pass a function that will be called when a disconnection occurs. It takes *(client)*
|
||||||
as positional argument (look at the section below for a detailed description).
|
as positional argument (look at the section below for a detailed description).
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself. Useful, for example, when you want to change the proxy before a new connection
|
The Client itself. Useful, for example, when you want to change the proxy before a new connection
|
||||||
is established.
|
is established.
|
||||||
"""
|
"""
|
||||||
|
@@ -26,20 +26,20 @@ class InlineQueryHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_inline_query() <pyrogram.Client.on_inline_query>` decorator.
|
:meth:`on_inline_query() <pyrogram.Client.on_inline_query>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a new InlineQuery arrives. It takes *(client, inline_query)*
|
Pass a function that will be called when a new InlineQuery arrives. It takes *(client, inline_query)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of inline queries to be passed
|
Pass one or more filters to allow only a subset of inline queries to be passed
|
||||||
in your callback function.
|
in your callback function.
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the inline query handler.
|
The Client itself, useful when you want to call other API methods inside the inline query handler.
|
||||||
|
|
||||||
inline_query (:obj:`InlineQuery <pyrogram.InlineQuery>`):
|
inline_query (:obj:`InlineQuery`):
|
||||||
The received inline query.
|
The received inline query.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -27,20 +27,20 @@ class MessageHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_message() <pyrogram.Client.on_message>` decorator.
|
:meth:`on_message() <pyrogram.Client.on_message>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a new Message arrives. It takes *(client, message)*
|
Pass a function that will be called when a new Message arrives. It takes *(client, message)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of messages to be passed
|
Pass one or more filters to allow only a subset of messages to be passed
|
||||||
in your callback function.
|
in your callback function.
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the message handler.
|
The Client itself, useful when you want to call other API methods inside the message handler.
|
||||||
|
|
||||||
message (:obj:`Message <pyrogram.Message>`):
|
message (:obj:`Message`):
|
||||||
The received message.
|
The received message.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ class PollHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_poll() <pyrogram.Client.on_poll>` decorator.
|
:meth:`on_poll() <pyrogram.Client.on_poll>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a new poll update arrives. It takes *(client, poll)*
|
Pass a function that will be called when a new poll update arrives. It takes *(client, poll)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
@@ -26,14 +26,14 @@ class RawUpdateHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_raw_update() <pyrogram.Client.on_raw_update>` decorator.
|
:meth:`on_raw_update() <pyrogram.Client.on_raw_update>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
A function that will be called when a new update is received from the server. It takes
|
A function that will be called when a new update is received from the server. It takes
|
||||||
*(client, update, users, chats)* as positional arguments (look at the section below for
|
*(client, update, users, chats)* as positional arguments (look at the section below for
|
||||||
a detailed description).
|
a detailed description).
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:class:`Client <pyrogram.Client>`):
|
client (:class:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the update handler.
|
The Client itself, useful when you want to call other API methods inside the update handler.
|
||||||
|
|
||||||
update (``Update``):
|
update (``Update``):
|
||||||
|
@@ -26,20 +26,20 @@ class UserStatusHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the
|
For a nicer way to register this handler, have a look at the
|
||||||
:meth:`on_user_status() <pyrogram.Client.on_user_status>` decorator.
|
:meth:`on_user_status() <pyrogram.Client.on_user_status>` decorator.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``callable``):
|
||||||
Pass a function that will be called when a new UserStatus update arrives. It takes *(client, user_status)*
|
Pass a function that will be called when a new UserStatus update arrives. It takes *(client, user_status)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of messages to be passed
|
Pass one or more filters to allow only a subset of messages to be passed
|
||||||
in your callback function.
|
in your callback function.
|
||||||
|
|
||||||
Other parameters:
|
Other parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the user status handler.
|
The Client itself, useful when you want to call other API methods inside the user status handler.
|
||||||
|
|
||||||
user_status (:obj:`UserStatus <pyrogram.UserStatus>`):
|
user_status (:obj:`UserStatus`):
|
||||||
The received UserStatus update.
|
The received UserStatus update.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class AnswerCallbackQuery(BaseClient):
|
|||||||
"""Use this method to send answers to callback queries sent from inline keyboards.
|
"""Use this method to send answers to callback queries sent from inline keyboards.
|
||||||
The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
|
The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
callback_query_id (``str``):
|
callback_query_id (``str``):
|
||||||
Unique identifier for the query to be answered.
|
Unique identifier for the query to be answered.
|
||||||
|
|
||||||
@@ -54,10 +54,10 @@ class AnswerCallbackQuery(BaseClient):
|
|||||||
Telegram apps will support caching starting in version 3.14. Defaults to 0.
|
Telegram apps will support caching starting in version 3.14. Defaults to 0.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True, on success.
|
``bool``: True, on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.messages.SetBotCallbackAnswer(
|
functions.messages.SetBotCallbackAnswer(
|
||||||
|
@@ -37,7 +37,7 @@ class AnswerInlineQuery(BaseClient):
|
|||||||
"""Use this method to send answers to an inline query.
|
"""Use this method to send answers to an inline query.
|
||||||
No more than 50 results per query are allowed.
|
No more than 50 results per query are allowed.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
inline_query_id (``str``):
|
inline_query_id (``str``):
|
||||||
Unique identifier for the answered query.
|
Unique identifier for the answered query.
|
||||||
|
|
||||||
@@ -73,7 +73,10 @@ class AnswerInlineQuery(BaseClient):
|
|||||||
where they wanted to use the bot's inline capabilities.
|
where they wanted to use the bot's inline capabilities.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, True is returned.
|
``bool``: On success, True is returned.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.messages.SetInlineBotResults(
|
functions.messages.SetInlineBotResults(
|
||||||
|
@@ -29,10 +29,10 @@ class GetGameHighScores(BaseClient):
|
|||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int = None
|
message_id: int = None
|
||||||
):
|
) -> "pyrogram.GameHighScores":
|
||||||
"""Use this method to get data for high score tables.
|
"""Use this method to get data for high score tables.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
user_id (``int`` | ``str``):
|
user_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -49,10 +49,10 @@ class GetGameHighScores(BaseClient):
|
|||||||
Required if inline_message_id is not specified.
|
Required if inline_message_id is not specified.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`GameHighScores <pyrogram.GameHighScores>` object is returned.
|
:obj:`GameHighScores`: On success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
# TODO: inline_message_id
|
# TODO: inline_message_id
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class GetInlineBotResults(BaseClient):
|
|||||||
"""Use this method to get bot results via inline queries.
|
"""Use this method to get bot results via inline queries.
|
||||||
You can then send a result using :obj:`send_inline_bot_result <pyrogram.Client.send_inline_bot_result>`
|
You can then send a result using :obj:`send_inline_bot_result <pyrogram.Client.send_inline_bot_result>`
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
bot (``int`` | ``str``):
|
bot (``int`` | ``str``):
|
||||||
Unique identifier of the inline bot you want to get results from. You can specify
|
Unique identifier of the inline bot you want to get results from. You can specify
|
||||||
a @username (str) or a bot ID (int).
|
a @username (str) or a bot ID (int).
|
||||||
@@ -55,11 +55,11 @@ class GetInlineBotResults(BaseClient):
|
|||||||
Useful for location-based results only.
|
Useful for location-based results only.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On Success, :obj:`BotResults <pyrogram.api.types.messages.BotResults>` is returned.
|
:obj:`BotResults <pyrogram.api.types.messages.BotResults>`: On Success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``TimeoutError`` if the bot fails to answer within 10 seconds
|
TimeoutError: In case the bot fails to answer within 10 seconds.
|
||||||
"""
|
"""
|
||||||
# TODO: Don't return the raw type
|
# TODO: Don't return the raw type
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class RequestCallbackAnswer(BaseClient):
|
|||||||
"""Use this method to request a callback answer from bots.
|
"""Use this method to request a callback answer from bots.
|
||||||
This is the equivalent of clicking an inline button containing callback data.
|
This is the equivalent of clicking an inline button containing callback data.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -49,8 +49,8 @@ class RequestCallbackAnswer(BaseClient):
|
|||||||
or as an alert.
|
or as an alert.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``TimeoutError`` if the bot fails to answer within 10 seconds.
|
TimeoutError: In case the bot fails to answer within 10 seconds.
|
||||||
"""
|
"""
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.messages.GetBotCallbackAnswer(
|
functions.messages.GetBotCallbackAnswer(
|
||||||
|
@@ -39,7 +39,7 @@ class SendGame(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send a game.
|
"""Use this method to send a game.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -60,10 +60,10 @@ class SendGame(BaseClient):
|
|||||||
If not empty, the first button must launch the game.
|
If not empty, the first button must launch the game.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message` is returned.
|
:obj:`Message`: On success, the sent game message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
|
@@ -35,7 +35,7 @@ class SendInlineBotResult(BaseClient):
|
|||||||
"""Use this method to send an inline bot result.
|
"""Use this method to send an inline bot result.
|
||||||
Bot results can be retrieved using :obj:`get_inline_bot_results <pyrogram.Client.get_inline_bot_results>`
|
Bot results can be retrieved using :obj:`get_inline_bot_results <pyrogram.Client.get_inline_bot_results>`
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -61,7 +61,7 @@ class SendInlineBotResult(BaseClient):
|
|||||||
On success, the sent Message is returned.
|
On success, the sent Message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.messages.SendInlineBotResult(
|
functions.messages.SendInlineBotResult(
|
||||||
|
@@ -36,7 +36,7 @@ class SetGameScore(BaseClient):
|
|||||||
# inline_message_id: str = None): TODO Add inline_message_id
|
# inline_message_id: str = None): TODO Add inline_message_id
|
||||||
"""Use this method to set the score of the specified user in a game.
|
"""Use this method to set the score of the specified user in a game.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
user_id (``int`` | ``str``):
|
user_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -63,12 +63,11 @@ class SetGameScore(BaseClient):
|
|||||||
Required if inline_message_id is not specified.
|
Required if inline_message_id is not specified.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, if the message was sent by the bot, returns the edited :obj:`Message <pyrogram.Message>`,
|
On success, if the message was sent by the bot, returns the edited :obj:`Message`,
|
||||||
otherwise returns True.
|
otherwise returns True.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
:class:`BotScoreNotModified` if the new score is not greater than the user's current score in the chat and force is False.
|
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SetGameScore(
|
functions.messages.SetGameScore(
|
||||||
|
@@ -35,15 +35,15 @@ class DeleteChatPhoto(BaseClient):
|
|||||||
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
||||||
setting is off.
|
setting is off.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id belongs to user.
|
``ValueError`` if a chat_id belongs to user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
@@ -38,16 +38,16 @@ class ExportChatInviteLink(BaseClient):
|
|||||||
using this method – after this the link will become available to the bot via the :meth:`get_chat` method.
|
using this method – after this the link will become available to the bot via the :meth:`get_chat` method.
|
||||||
If your bot needs to generate a new invite link replacing its previous one, use this method again.
|
If your bot needs to generate a new invite link replacing its previous one, use this method again.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier for the target chat or username of the target channel/supergroup
|
Unique identifier for the target chat or username of the target channel/supergroup
|
||||||
(in the format @username).
|
(in the format @username).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the exported invite link as string is returned.
|
``str``: On success, the exported invite link is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
|
@@ -32,18 +32,18 @@ class GetChat(BaseClient):
|
|||||||
Information include current name of the user for one-on-one conversations, current username of a user, group or
|
Information include current name of the user for one-on-one conversations, current username of a user, group or
|
||||||
channel, etc.
|
channel, etc.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username
|
Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username
|
||||||
of the target channel/supergroup (in the format @username).
|
of the target channel/supergroup (in the format @username).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
|
:obj:`Chat`: On success, a chat object is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` in case the chat invite link refers to a chat you haven't joined yet.
|
ValueError: In case the chat invite link points to a chat you haven't joined yet.
|
||||||
"""
|
"""
|
||||||
match = self.INVITE_LINK_RE.match(str(chat_id))
|
match = self.INVITE_LINK_RE.match(str(chat_id))
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class GetChatMember(BaseClient):
|
|||||||
) -> "pyrogram.ChatMember":
|
) -> "pyrogram.ChatMember":
|
||||||
"""Use this method to get information about one member of a chat.
|
"""Use this method to get information about one member of a chat.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -42,10 +42,10 @@ class GetChatMember(BaseClient):
|
|||||||
For a contact that exists in your Telegram address book you can use his phone number (str).
|
For a contact that exists in your Telegram address book you can use his phone number (str).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`ChatMember <pyrogram.ChatMember>` object is returned.
|
:obj:`ChatMember`: On success, a chat member is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
chat_id = self.resolve_peer(chat_id)
|
chat_id = self.resolve_peer(chat_id)
|
||||||
user_id = self.resolve_peer(user_id)
|
user_id = self.resolve_peer(user_id)
|
||||||
|
@@ -53,7 +53,7 @@ class GetChatMembers(BaseClient):
|
|||||||
You must be admin to retrieve the members list of a channel (also known as "subscribers").
|
You must be admin to retrieve the members list of a channel (also known as "subscribers").
|
||||||
For a more convenient way of getting chat members see :meth:`iter_chat_members`.
|
For a more convenient way of getting chat members see :meth:`iter_chat_members`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -86,11 +86,11 @@ class GetChatMembers(BaseClient):
|
|||||||
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
|
.. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`ChatMembers` object is returned.
|
:obj:`ChatMembers`: On success, an object containing a list of chat members is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if you used an invalid filter or a chat_id that belongs to a user.
|
ValueError: In case you used an invalid filter or a chat id that belongs to a user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ class GetChatMembersCount(BaseClient):
|
|||||||
) -> int:
|
) -> int:
|
||||||
"""Use this method to get the number of members in a chat.
|
"""Use this method to get the number of members in a chat.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ class GetChatMembersCount(BaseClient):
|
|||||||
On success, an integer is returned.
|
On success, an integer is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id belongs to user.
|
ValueError: In case a chat id belongs to user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
|
@@ -30,16 +30,18 @@ class GetChatPreview(BaseClient):
|
|||||||
|
|
||||||
This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
|
This method only returns a chat preview, if you want to join a chat use :meth:`join_chat`
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
invite_link (``str``):
|
invite_link (``str``):
|
||||||
Unique identifier for the target chat in form of *t.me/joinchat/* links.
|
Unique identifier for the target chat in form of *t.me/joinchat/* links.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Either :obj:`Chat` or :obj:`ChatPreview`, depending on whether you already joined the chat or not.
|
:obj:`Chat`: In case you already joined the chat.
|
||||||
|
|
||||||
|
:obj:`ChatPreview` -- In case you haven't joined the chat yet.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` in case of an invalid invite_link.
|
ValueError: In case of an invalid invite link.
|
||||||
"""
|
"""
|
||||||
match = self.INVITE_LINK_RE.match(invite_link)
|
match = self.INVITE_LINK_RE.match(invite_link)
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ class GetDialogs(BaseClient):
|
|||||||
You can get up to 100 dialogs at once.
|
You can get up to 100 dialogs at once.
|
||||||
For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`.
|
For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
offset_date (``int``):
|
offset_date (``int``):
|
||||||
The offset date in Unix time taken from the top message of a :obj:`Dialog`.
|
The offset date in Unix time taken from the top message of a :obj:`Dialog`.
|
||||||
Defaults to 0. Valid for non-pinned dialogs only.
|
Defaults to 0. Valid for non-pinned dialogs only.
|
||||||
@@ -53,10 +53,10 @@ class GetDialogs(BaseClient):
|
|||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Dialogs` object is returned.
|
:obj:`Dialogs`: On success, an object containing a list of dialogs is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@@ -29,10 +29,10 @@ class GetDialogsCount(BaseClient):
|
|||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, an integer is returned.
|
``int``: On success, an integer is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if pinned_only:
|
if pinned_only:
|
||||||
|
@@ -51,7 +51,7 @@ class IterChatMembers(BaseClient):
|
|||||||
from the hassle of setting up boilerplate code. It is useful for getting the whole members list of a chat with
|
from the hassle of setting up boilerplate code. It is useful for getting the whole members list of a chat with
|
||||||
a single call.
|
a single call.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -75,10 +75,10 @@ class IterChatMembers(BaseClient):
|
|||||||
Defaults to *"all"*.
|
Defaults to *"all"*.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A generator yielding :obj:`ChatMember <pyrogram.ChatMember>` objects.
|
``Generator``: A generator yielding :obj:`ChatMember` objects.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
current = 0
|
current = 0
|
||||||
yielded = set()
|
yielded = set()
|
||||||
|
@@ -33,7 +33,7 @@ class IterDialogs(BaseClient):
|
|||||||
This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus saving you from
|
This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus saving you from
|
||||||
the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a single call.
|
the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a single call.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
offset_date (``int``):
|
offset_date (``int``):
|
||||||
The offset date in Unix time taken from the top message of a :obj:`Dialog`.
|
The offset date in Unix time taken from the top message of a :obj:`Dialog`.
|
||||||
Defaults to 0 (most recent dialog).
|
Defaults to 0 (most recent dialog).
|
||||||
@@ -43,10 +43,10 @@ class IterDialogs(BaseClient):
|
|||||||
By default, no limit is applied and all dialogs are returned.
|
By default, no limit is applied and all dialogs are returned.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A generator yielding :obj:`Dialog <pyrogram.Dialog>` objects.
|
``Generator``: A generator yielding :obj:`Dialog` objects.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
current = 0
|
current = 0
|
||||||
total = limit or (1 << 31) - 1
|
total = limit or (1 << 31) - 1
|
||||||
|
@@ -28,16 +28,16 @@ class JoinChat(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method to join a group chat or channel.
|
"""Use this method to join a group chat or channel.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``str``):
|
chat_id (``str``):
|
||||||
Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
|
Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target
|
||||||
channel/supergroup (in the format @username).
|
channel/supergroup (in the format @username).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
|
:obj:`Chat`: On success, a chat object is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
match = self.INVITE_LINK_RE.match(chat_id)
|
match = self.INVITE_LINK_RE.match(chat_id)
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ class KickChatMember(BaseClient):
|
|||||||
off in the target group. Otherwise members may only be removed by the group's creator or by the member
|
off in the target group. Otherwise members may only be removed by the group's creator or by the member
|
||||||
that added them.
|
that added them.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -54,10 +54,12 @@ class KickChatMember(BaseClient):
|
|||||||
considered to be banned forever. Defaults to 0 (ban forever).
|
considered to be banned forever. Defaults to 0 (ban forever).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, either True or a service :obj:`Message <pyrogram.Message>` will be returned (when applicable).
|
:obj:`Message`: On success, a service message will be returned (when applicable).
|
||||||
|
|
||||||
|
``bool`` -- True, in case a message object couldn't be returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
chat_peer = self.resolve_peer(chat_id)
|
chat_peer = self.resolve_peer(chat_id)
|
||||||
user_peer = self.resolve_peer(user_id)
|
user_peer = self.resolve_peer(user_id)
|
||||||
|
@@ -30,7 +30,7 @@ class LeaveChat(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method to leave a group chat or channel.
|
"""Use this method to leave a group chat or channel.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier for the target chat or username of the target channel/supergroup
|
Unique identifier for the target chat or username of the target channel/supergroup
|
||||||
(in the format @username).
|
(in the format @username).
|
||||||
@@ -39,7 +39,7 @@ class LeaveChat(BaseClient):
|
|||||||
Deletes the group chat dialog after leaving (for simple group chats, not supergroups).
|
Deletes the group chat dialog after leaving (for simple group chats, not supergroups).
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ class PinChatMessage(BaseClient):
|
|||||||
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
|
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
|
||||||
the supergroup or "can_edit_messages" admin right in the channel.
|
the supergroup or "can_edit_messages" admin right in the channel.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ class PinChatMessage(BaseClient):
|
|||||||
message. Notifications are always disabled in channels.
|
message. Notifications are always disabled in channels.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
self.send(
|
self.send(
|
||||||
functions.messages.UpdatePinnedMessage(
|
functions.messages.UpdatePinnedMessage(
|
||||||
|
@@ -41,7 +41,7 @@ class PromoteChatMember(BaseClient):
|
|||||||
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||||
Pass False for all boolean parameters to demote a user.
|
Pass False for all boolean parameters to demote a user.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -76,10 +76,10 @@ class PromoteChatMember(BaseClient):
|
|||||||
were appointed by him).
|
were appointed by him).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
self.send(
|
self.send(
|
||||||
functions.channels.EditAdmin(
|
functions.channels.EditAdmin(
|
||||||
|
@@ -39,7 +39,7 @@ class RestrictChat(BaseClient):
|
|||||||
"""Use this method to restrict a chat.
|
"""Use this method to restrict a chat.
|
||||||
Pass True for all boolean parameters to lift restrictions from a chat.
|
Pass True for all boolean parameters to lift restrictions from a chat.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -70,10 +70,10 @@ class RestrictChat(BaseClient):
|
|||||||
Pass True, if the user can pin messages.
|
Pass True, if the user can pin messages.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
|
:obj:`Chat`: On success, a chat object is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
send_messages = True
|
send_messages = True
|
||||||
send_media = True
|
send_media = True
|
||||||
|
@@ -43,7 +43,7 @@ class RestrictChatMember(BaseClient):
|
|||||||
The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
|
The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.
|
||||||
Pass True for all boolean parameters to lift restrictions from a user.
|
Pass True for all boolean parameters to lift restrictions from a user.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -83,10 +83,10 @@ class RestrictChatMember(BaseClient):
|
|||||||
Pass True, if the user can pin messages.
|
Pass True, if the user can pin messages.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Chat <pyrogram.Chat>` object is returned.
|
:obj:`Chat`: On success, a chat object is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
send_messages = True
|
send_messages = True
|
||||||
send_media = True
|
send_media = True
|
||||||
|
@@ -31,7 +31,7 @@ class SetChatDescription(BaseClient):
|
|||||||
"""Use this method to change the description of a supergroup or a channel.
|
"""Use this method to change the description of a supergroup or a channel.
|
||||||
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
You must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ class SetChatDescription(BaseClient):
|
|||||||
New chat description, 0-255 characters.
|
New chat description, 0-255 characters.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id doesn't belong to a supergroup or a channel.
|
``ValueError`` if a chat_id doesn't belong to a supergroup or a channel.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
@@ -39,7 +39,7 @@ class SetChatPhoto(BaseClient):
|
|||||||
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
||||||
setting is off.
|
setting is off.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ class SetChatPhoto(BaseClient):
|
|||||||
New chat photo. You can pass a :class:`Photo` id or a file path to upload a new photo.
|
New chat photo. You can pass a :class:`Photo` id or a file path to upload a new photo.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id belongs to user.
|
``ValueError`` if a chat_id belongs to user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
@@ -36,7 +36,7 @@ class SetChatTitle(BaseClient):
|
|||||||
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
In regular groups (non-supergroups), this method will only work if the "All Members Are Admins"
|
||||||
setting is off.
|
setting is off.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -44,11 +44,11 @@ class SetChatTitle(BaseClient):
|
|||||||
New chat title, 1-255 characters.
|
New chat title, 1-255 characters.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id belongs to user.
|
ValueError: In case a chat id belongs to user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class UnbanChatMember(BaseClient):
|
|||||||
The user will **not** return to the group or channel automatically, but will be able to join via link, etc.
|
The user will **not** return to the group or channel automatically, but will be able to join via link, etc.
|
||||||
You must be an administrator for this to work.
|
You must be an administrator for this to work.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
@@ -41,10 +41,10 @@ class UnbanChatMember(BaseClient):
|
|||||||
For a contact that exists in your Telegram address book you can use his phone number (str).
|
For a contact that exists in your Telegram address book you can use his phone number (str).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
self.send(
|
self.send(
|
||||||
functions.channels.EditBanned(
|
functions.channels.EditBanned(
|
||||||
|
@@ -31,15 +31,15 @@ class UnpinChatMessage(BaseClient):
|
|||||||
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
|
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin
|
||||||
right in the supergroup or "can_edit_messages" admin right in the channel.
|
right in the supergroup or "can_edit_messages" admin right in the channel.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
self.send(
|
self.send(
|
||||||
functions.messages.UpdatePinnedMessage(
|
functions.messages.UpdatePinnedMessage(
|
||||||
|
@@ -32,18 +32,18 @@ class UpdateChatUsername(BaseClient):
|
|||||||
|
|
||||||
To update your own username (for users only, not bots) you can use :meth:`update_username`.
|
To update your own username (for users only, not bots) you can use :meth:`update_username`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``)
|
chat_id (``int`` | ``str``)
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
username (``str`` | ``None``):
|
username (``str`` | ``None``):
|
||||||
Username to set. Pass "" (empty string) or None to remove the username.
|
Username to set. Pass "" (empty string) or None to remove the username.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if a chat_id belongs to a user or chat.
|
ValueError: In case a chat id belongs to a user or chat.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
@@ -30,15 +30,12 @@ class AddContacts(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method to add contacts to your Telegram address book.
|
"""Use this method to add contacts to your Telegram address book.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
contacts (List of :obj:`InputPhoneContact <pyrogram.InputPhoneContact>`):
|
contacts (List of :obj:`InputPhoneContact`):
|
||||||
The contact list to be added
|
The contact list to be added
|
||||||
|
|
||||||
Returns:
|
|
||||||
On success, the added contacts are returned.
|
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
imported_contacts = self.send(
|
imported_contacts = self.send(
|
||||||
functions.contacts.ImportContacts(
|
functions.contacts.ImportContacts(
|
||||||
|
@@ -30,16 +30,16 @@ class DeleteContacts(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method to delete contacts from your Telegram address book.
|
"""Use this method to delete contacts from your Telegram address book.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
ids (List of ``int``):
|
ids (List of ``int``):
|
||||||
A list of unique identifiers for the target users.
|
A list of unique identifiers for the target users.
|
||||||
Can be an ID (int), a username (string) or phone number (string).
|
Can be an ID (int), a username (string) or phone number (string).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
contacts = []
|
contacts = []
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
from typing import List
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import functions
|
from pyrogram.api import functions
|
||||||
@@ -28,14 +29,14 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class GetContacts(BaseClient):
|
class GetContacts(BaseClient):
|
||||||
def get_contacts(self):
|
def get_contacts(self) -> List["pyrogram.User"]:
|
||||||
"""Use this method to get contacts from your Telegram address book.
|
"""Use this method to get contacts from your Telegram address book.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a list of :obj:`User` objects is returned.
|
List of :obj:`User`: On success, a list of users is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@@ -25,10 +25,10 @@ class GetContactsCount(BaseClient):
|
|||||||
"""Use this method to get the total count of contacts from your Telegram address book.
|
"""Use this method to get the total count of contacts from your Telegram address book.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, an integer is returned.
|
``int``: On success, an integer is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return len(self.send(functions.contacts.GetContacts(hash=0)).contacts)
|
return len(self.send(functions.contacts.GetContacts(hash=0)).contacts)
|
||||||
|
@@ -33,8 +33,8 @@ class OnCallbackQuery(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling callback queries.
|
"""Use this decorator to automatically register a function for handling callback queries.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of callback queries to be passed
|
Pass one or more filters to allow only a subset of callback queries to be passed
|
||||||
in your function.
|
in your function.
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ class OnDeletedMessages(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling deleted messages.
|
"""Use this decorator to automatically register a function for handling deleted messages.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of messages to be passed
|
Pass one or more filters to allow only a subset of messages to be passed
|
||||||
in your function.
|
in your function.
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ class OnInlineQuery(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling inline queries.
|
"""Use this decorator to automatically register a function for handling inline queries.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`InlineQueryHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`InlineQueryHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters <pyrogram.Filters>`):
|
||||||
Pass one or more filters to allow only a subset of inline queries to be passed
|
Pass one or more filters to allow only a subset of inline queries to be passed
|
||||||
in your function.
|
in your function.
|
||||||
|
@@ -33,8 +33,8 @@ class OnMessage(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling messages.
|
"""Use this decorator to automatically register a function for handling messages.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of messages to be passed
|
Pass one or more filters to allow only a subset of messages to be passed
|
||||||
in your function.
|
in your function.
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ class OnPoll(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling poll updates.
|
"""Use this decorator to automatically register a function for handling poll updates.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`PollHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`PollHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters <pyrogram.Filters>`):
|
||||||
Pass one or more filters to allow only a subset of polls to be passed
|
Pass one or more filters to allow only a subset of polls to be passed
|
||||||
in your function.
|
in your function.
|
||||||
|
@@ -31,7 +31,7 @@ class OnRawUpdate(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling raw updates.
|
"""Use this decorator to automatically register a function for handling raw updates.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
group (``int``, *optional*):
|
group (``int``, *optional*):
|
||||||
The group identifier, defaults to 0.
|
The group identifier, defaults to 0.
|
||||||
"""
|
"""
|
||||||
|
@@ -33,8 +33,8 @@ class OnUserStatus(BaseClient):
|
|||||||
"""Use this decorator to automatically register a function for handling user status updates.
|
"""Use this decorator to automatically register a function for handling user status updates.
|
||||||
This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`.
|
This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters`):
|
||||||
Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function.
|
Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function.
|
||||||
|
|
||||||
group (``int``, *optional*):
|
group (``int``, *optional*):
|
||||||
|
@@ -31,7 +31,7 @@ class DeleteMessages(BaseClient):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to delete messages, including service messages.
|
"""Use this method to delete messages, including service messages.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -48,10 +48,10 @@ class DeleteMessages(BaseClient):
|
|||||||
Defaults to True.
|
Defaults to True.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success, False otherwise.
|
``bool``: True on success, False otherwise.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids]
|
message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids]
|
||||||
|
@@ -34,8 +34,8 @@ class DownloadMedia(BaseClient):
|
|||||||
) -> Union[str, None]:
|
) -> Union[str, None]:
|
||||||
"""Use this method to download the media from a message.
|
"""Use this method to download the media from a message.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
message (:obj:`Message <pyrogram.Message>` | ``str``):
|
message (:obj:`Message` | ``str``):
|
||||||
Pass a Message containing the media, the media itself (message.audio, message.video, ...) or
|
Pass a Message containing the media, the media itself (message.audio, message.video, ...) or
|
||||||
the file id as string.
|
the file id as string.
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class DownloadMedia(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -73,11 +73,12 @@ class DownloadMedia(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the absolute path of the downloaded file as string is returned, None otherwise.
|
``str``: On success, the absolute path of the downloaded file is returned.
|
||||||
In case the download is deliberately stopped with :meth:`stop_transmission`, None is returned as well.
|
|
||||||
|
``None`` -- In case the download is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if the message doesn't contain any downloadable media
|
``ValueError`` if the message doesn't contain any downloadable media
|
||||||
"""
|
"""
|
||||||
error_message = "This message doesn't contain any downloadable media"
|
error_message = "This message doesn't contain any downloadable media"
|
||||||
|
@@ -34,7 +34,7 @@ class EditMessageCaption(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to edit captions of messages.
|
"""Use this method to edit captions of messages.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -47,18 +47,17 @@ class EditMessageCaption(BaseClient):
|
|||||||
New caption of the message.
|
New caption of the message.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
|
reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
|
||||||
An InlineKeyboardMarkup object.
|
An InlineKeyboardMarkup object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the edited :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the edited message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ class EditMessageMedia(BaseClient):
|
|||||||
Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent
|
Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent
|
||||||
by the bot, the edited Message is returned, otherwise True is returned.
|
by the bot, the edited Message is returned, otherwise True is returned.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -63,10 +63,10 @@ class EditMessageMedia(BaseClient):
|
|||||||
An InlineKeyboardMarkup object.
|
An InlineKeyboardMarkup object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the edited :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the edited message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
style = self.html if media.parse_mode.lower() == "html" else self.markdown
|
style = self.html if media.parse_mode.lower() == "html" else self.markdown
|
||||||
caption = media.caption
|
caption = media.caption
|
||||||
|
@@ -32,7 +32,7 @@ class EditMessageReplyMarkup(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
|
"""Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -45,11 +45,12 @@ class EditMessageReplyMarkup(BaseClient):
|
|||||||
An InlineKeyboardMarkup object.
|
An InlineKeyboardMarkup object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, if edited message is sent by the bot, the edited
|
:obj:`Message`: In case the edited message is sent by the bot.
|
||||||
:obj:`Message <pyrogram.Message>` is returned, otherwise True is returned.
|
|
||||||
|
``bool`` -- True, in case the edited message is sent by the user.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
r = self.send(
|
r = self.send(
|
||||||
|
@@ -35,7 +35,7 @@ class EditMessageText(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to edit text messages.
|
"""Use this method to edit text messages.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -48,9 +48,8 @@ class EditMessageText(BaseClient):
|
|||||||
New text of the message.
|
New text of the message.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
|
URLs in your message. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
disable_web_page_preview (``bool``, *optional*):
|
disable_web_page_preview (``bool``, *optional*):
|
||||||
Disables link previews for links in this message.
|
Disables link previews for links in this message.
|
||||||
@@ -59,10 +58,10 @@ class EditMessageText(BaseClient):
|
|||||||
An InlineKeyboardMarkup object.
|
An InlineKeyboardMarkup object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the edited :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the edited message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class ForwardMessages(BaseClient):
|
|||||||
) -> "pyrogram.Messages":
|
) -> "pyrogram.Messages":
|
||||||
"""Use this method to forward messages of any kind.
|
"""Use this method to forward messages of any kind.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -64,13 +64,14 @@ class ForwardMessages(BaseClient):
|
|||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success and in case *message_ids* was an iterable, the returned value will be a list of the forwarded
|
:obj:`Message`: In case *message_ids* was an integer, the single forwarded message is
|
||||||
:obj:`Messages <pyrogram.Message>` even if a list contains just one element, otherwise if
|
returned.
|
||||||
*message_ids* was an integer, the single forwarded :obj:`Message <pyrogram.Message>`
|
|
||||||
is returned.
|
:obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an
|
||||||
|
object containing a list of messages, even if such iterable contained just a single element.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
is_iterable = not isinstance(message_ids, int)
|
is_iterable = not isinstance(message_ids, int)
|
||||||
|
@@ -43,7 +43,7 @@ class GetHistory(BaseClient):
|
|||||||
You can get up to 100 messages at once.
|
You can get up to 100 messages at once.
|
||||||
For a more convenient way of getting a chat history see :meth:`iter_history`.
|
For a more convenient way of getting a chat history see :meth:`iter_history`.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -67,10 +67,10 @@ class GetHistory(BaseClient):
|
|||||||
Pass True to retrieve the messages in reversed order (from older to most recent).
|
Pass True to retrieve the messages in reversed order (from older to most recent).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Messages <pyrogram.Messages>` object is returned.
|
:obj:`Messages` - On success, an object containing a list of the retrieved messages.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@@ -40,15 +40,15 @@ class GetHistoryCount(BaseClient):
|
|||||||
a **private** or a **basic group** chat has with a single method call. To overcome this limitation, Pyrogram
|
a **private** or a **basic group** chat has with a single method call. To overcome this limitation, Pyrogram
|
||||||
has to iterate over all the messages. Channels and supergroups are not affected by this limitation.
|
has to iterate over all the messages. Channels and supergroups are not affected by this limitation.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, an integer is returned.
|
``int``: On success, an integer is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
@@ -39,7 +39,7 @@ class GetMessages(BaseClient):
|
|||||||
"""Use this method to get one or more messages that belong to a specific chat.
|
"""Use this method to get one or more messages that belong to a specific chat.
|
||||||
You can retrieve up to 200 messages at once.
|
You can retrieve up to 200 messages at once.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -60,12 +60,14 @@ class GetMessages(BaseClient):
|
|||||||
Defaults to 1.
|
Defaults to 1.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a
|
:obj:`Message`: In case *message_ids* was an integer, the single forwarded message is
|
||||||
:obj:`Messages <pyrogram.Messages>` even if a list contains just one element. Otherwise, if *message_ids* or
|
returned.
|
||||||
*reply_to_message_ids* was an integer, the single requested :obj:`Message <pyrogram.Message>` is returned.
|
|
||||||
|
:obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an
|
||||||
|
object containing a list of messages, even if such iterable contained just a single element.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
ids, ids_type = (
|
ids, ids_type = (
|
||||||
(message_ids, types.InputMessageID) if message_ids
|
(message_ids, types.InputMessageID) if message_ids
|
||||||
|
@@ -37,7 +37,7 @@ class IterHistory(BaseClient):
|
|||||||
This convenience method does the same as repeatedly calling :meth:`get_history` in a loop, thus saving you from
|
This convenience method does the same as repeatedly calling :meth:`get_history` in a loop, thus saving you from
|
||||||
the hassle of setting up boilerplate code. It is useful for getting the whole chat history with a single call.
|
the hassle of setting up boilerplate code. It is useful for getting the whole chat history with a single call.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -61,10 +61,10 @@ class IterHistory(BaseClient):
|
|||||||
Pass True to retrieve the messages in reversed order (from older to most recent).
|
Pass True to retrieve the messages in reversed order (from older to most recent).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A generator yielding :obj:`Message <pyrogram.Message>` objects.
|
``Generator``: A generator yielding :obj:`Message` objects.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
offset_id = offset_id or (1 if reverse else 0)
|
offset_id = offset_id or (1 if reverse else 0)
|
||||||
current = 0
|
current = 0
|
||||||
|
@@ -31,7 +31,7 @@ class RetractVote(BaseClient):
|
|||||||
) -> "pyrogram.Poll":
|
) -> "pyrogram.Poll":
|
||||||
"""Use this method to retract your vote in a poll.
|
"""Use this method to retract your vote in a poll.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -41,10 +41,10 @@ class RetractVote(BaseClient):
|
|||||||
Identifier of the original message with the poll.
|
Identifier of the original message with the poll.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the :obj:`Poll <pyrogram.Poll>` with the retracted vote is returned.
|
:obj:`Poll`: On success, the poll with the retracted vote is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendVote(
|
functions.messages.SendVote(
|
||||||
|
@@ -51,7 +51,7 @@ class SendAnimation(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send animation files (animation or H.264/MPEG-4 AVC video without sound).
|
"""Use this method to send animation files (animation or H.264/MPEG-4 AVC video without sound).
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -67,9 +67,8 @@ class SendAnimation(BaseClient):
|
|||||||
Animation caption, 0-1024 characters.
|
Animation caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Duration of sent animation in seconds.
|
Duration of sent animation in seconds.
|
||||||
@@ -107,7 +106,7 @@ class SendAnimation(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -121,11 +120,12 @@ class SendAnimation(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent animation message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -53,7 +53,7 @@ class SendAudio(BaseClient):
|
|||||||
|
|
||||||
For sending voice messages, use the :obj:`send_voice()` method instead.
|
For sending voice messages, use the :obj:`send_voice()` method instead.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -69,9 +69,8 @@ class SendAudio(BaseClient):
|
|||||||
Audio caption, 0-1024 characters.
|
Audio caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Duration of the audio in seconds.
|
Duration of the audio in seconds.
|
||||||
@@ -109,7 +108,7 @@ class SendAudio(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -123,11 +122,12 @@ class SendAudio(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent audio message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -48,7 +48,7 @@ class SendCachedMedia(BaseClient):
|
|||||||
It does the same as calling the relevant method for sending media using a file_id, thus saving you from the
|
It does the same as calling the relevant method for sending media using a file_id, thus saving you from the
|
||||||
hassle of using the correct method for the media the file_id is pointing to.
|
hassle of using the correct method for the media the file_id is pointing to.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -62,9 +62,8 @@ class SendCachedMedia(BaseClient):
|
|||||||
Media caption, 0-1024 characters.
|
Media caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
@@ -78,10 +77,10 @@ class SendCachedMedia(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent media message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
|
||||||
|
@@ -31,15 +31,15 @@ class SendChatAction(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method when you need to tell the other party that something is happening on your side.
|
"""Use this method when you need to tell the other party that something is happening on your side.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
For a contact that exists in your Telegram address book you can use his phone number (str).
|
For a contact that exists in your Telegram address book you can use his phone number (str).
|
||||||
|
|
||||||
action (:obj:`ChatAction <pyrogram.ChatAction>` | ``str``):
|
action (:obj:`ChatAction` | ``str``):
|
||||||
Type of action to broadcast.
|
Type of action to broadcast.
|
||||||
Choose one from the :class:`ChatAction <pyrogram.ChatAction>` enumeration,
|
Choose one from the :class:`ChatAction` enumeration,
|
||||||
depending on what the user is about to receive.
|
depending on what the user is about to receive.
|
||||||
You can also provide a string (e.g. "typing", "upload_photo", "record_audio", ...).
|
You can also provide a string (e.g. "typing", "upload_photo", "record_audio", ...).
|
||||||
|
|
||||||
@@ -48,11 +48,11 @@ class SendChatAction(BaseClient):
|
|||||||
Currently useless because official clients don't seem to be handling this.
|
Currently useless because official clients don't seem to be handling this.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, True is returned.
|
``bool``: On success, True is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` if the provided string is not a valid ChatAction.
|
ValueError: In case the provided string is not a valid ChatAction.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Resolve Enum type
|
# Resolve Enum type
|
||||||
|
@@ -42,7 +42,7 @@ class SendContact(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send phone contacts.
|
"""Use this method to send phone contacts.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -72,10 +72,10 @@ class SendContact(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent contact message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
|
@@ -48,7 +48,7 @@ class SendDocument(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send general files.
|
"""Use this method to send general files.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -70,9 +70,8 @@ class SendDocument(BaseClient):
|
|||||||
Document caption, 0-1024 characters.
|
Document caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
@@ -95,7 +94,7 @@ class SendDocument(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -109,11 +108,12 @@ class SendDocument(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent document message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -40,7 +40,7 @@ class SendLocation(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send points on the map.
|
"""Use this method to send points on the map.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -64,10 +64,10 @@ class SendLocation(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent location message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
|
@@ -43,7 +43,7 @@ class SendMediaGroup(BaseClient):
|
|||||||
):
|
):
|
||||||
"""Use this method to send a group of photos or videos as an album.
|
"""Use this method to send a group of photos or videos as an album.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -60,11 +60,10 @@ class SendMediaGroup(BaseClient):
|
|||||||
If the message is a reply, ID of the original message.
|
If the message is a reply, ID of the original message.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`Messages <pyrogram.Messages>` object is returned containing all the
|
:obj:`Messages`: On success, an object is returned containing all the single messages sent.
|
||||||
single messages sent.
|
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
multi_media = []
|
multi_media = []
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ class SendMessage(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send text messages.
|
"""Use this method to send text messages.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -51,9 +51,8 @@ class SendMessage(BaseClient):
|
|||||||
Text of the message to be sent.
|
Text of the message to be sent.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message.
|
URLs in your message. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
disable_web_page_preview (``bool``, *optional*):
|
disable_web_page_preview (``bool``, *optional*):
|
||||||
Disables link previews for links in this message.
|
Disables link previews for links in this message.
|
||||||
@@ -70,10 +69,10 @@ class SendMessage(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message` is returned.
|
:obj:`Message`: On success, the sent text message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
message, entities = style.parse(text).values()
|
message, entities = style.parse(text).values()
|
||||||
|
@@ -48,7 +48,7 @@ class SendPhoto(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send photos.
|
"""Use this method to send photos.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -64,9 +64,8 @@ class SendPhoto(BaseClient):
|
|||||||
Photo caption, 0-1024 characters.
|
Photo caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
ttl_seconds (``int``, *optional*):
|
ttl_seconds (``int``, *optional*):
|
||||||
Self-Destruct Timer.
|
Self-Destruct Timer.
|
||||||
@@ -94,7 +93,7 @@ class SendPhoto(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -108,11 +107,12 @@ class SendPhoto(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent photo message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -40,7 +40,7 @@ class SendPoll(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send a new poll.
|
"""Use this method to send a new poll.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -64,10 +64,10 @@ class SendPoll(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent poll message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
|
@@ -45,7 +45,7 @@ class SendSticker(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send .webp stickers.
|
"""Use this method to send .webp stickers.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -78,7 +78,7 @@ class SendSticker(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -92,11 +92,12 @@ class SendSticker(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent sticker message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ class SendVenue(BaseClient):
|
|||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Use this method to send information about a venue.
|
"""Use this method to send information about a venue.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -81,10 +81,10 @@ class SendVenue(BaseClient):
|
|||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent venue message is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
r = self.send(
|
r = self.send(
|
||||||
functions.messages.SendMedia(
|
functions.messages.SendMedia(
|
||||||
|
@@ -52,7 +52,7 @@ class SendVideo(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send video files.
|
"""Use this method to send video files.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -68,9 +68,8 @@ class SendVideo(BaseClient):
|
|||||||
Video caption, 0-1024 characters.
|
Video caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Duration of sent video in seconds.
|
Duration of sent video in seconds.
|
||||||
@@ -111,7 +110,7 @@ class SendVideo(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -125,11 +124,12 @@ class SendVideo(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent video message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -48,7 +48,7 @@ class SendVideoNote(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send video messages.
|
"""Use this method to send video messages.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -93,7 +93,7 @@ class SendVideoNote(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -107,11 +107,12 @@ class SendVideoNote(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent video note message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ class SendVoice(BaseClient):
|
|||||||
) -> Union["pyrogram.Message", None]:
|
) -> Union["pyrogram.Message", None]:
|
||||||
"""Use this method to send audio files.
|
"""Use this method to send audio files.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -64,9 +64,8 @@ class SendVoice(BaseClient):
|
|||||||
Voice message caption, 0-1024 characters.
|
Voice message caption, 0-1024 characters.
|
||||||
|
|
||||||
parse_mode (``str``, *optional*):
|
parse_mode (``str``, *optional*):
|
||||||
Use :obj:`MARKDOWN <pyrogram.ParseMode.MARKDOWN>` or :obj:`HTML <pyrogram.ParseMode.HTML>`
|
Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline
|
||||||
if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption.
|
URLs in your caption. Defaults to "markdown".
|
||||||
Defaults to Markdown.
|
|
||||||
|
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Duration of the voice message in seconds.
|
Duration of the voice message in seconds.
|
||||||
@@ -92,7 +91,7 @@ class SendVoice(BaseClient):
|
|||||||
a chat_id and a message_id in order to edit a message with the updated progress.
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
Other Parameters:
|
Other Parameters:
|
||||||
client (:obj:`Client <pyrogram.Client>`):
|
client (:obj:`Client`):
|
||||||
The Client itself, useful when you want to call other API methods inside the callback function.
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
current (``int``):
|
current (``int``):
|
||||||
@@ -106,11 +105,12 @@ class SendVoice(BaseClient):
|
|||||||
You can either keep *\*args* or add every single extra argument in your function signature.
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the sent :obj:`Message <pyrogram.Message>` is returned.
|
:obj:`Message`: On success, the sent voice message is returned.
|
||||||
In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead.
|
|
||||||
|
``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
file = None
|
file = None
|
||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
@@ -34,7 +34,7 @@ class StopPoll(BaseClient):
|
|||||||
|
|
||||||
Stopped polls can't be reopened and nobody will be able to vote in it anymore.
|
Stopped polls can't be reopened and nobody will be able to vote in it anymore.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -47,10 +47,10 @@ class StopPoll(BaseClient):
|
|||||||
An InlineKeyboardMarkup object.
|
An InlineKeyboardMarkup object.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the stopped :obj:`Poll <pyrogram.Poll>` with the final results is returned.
|
:obj:`Poll`: On success, the stopped poll with the final results is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
poll = self.get_messages(chat_id, message_id).poll
|
poll = self.get_messages(chat_id, message_id).poll
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class VotePoll(BaseClient):
|
|||||||
) -> "pyrogram.Poll":
|
) -> "pyrogram.Poll":
|
||||||
"""Use this method to vote a poll.
|
"""Use this method to vote a poll.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -45,10 +45,10 @@ class VotePoll(BaseClient):
|
|||||||
Index of the poll option you want to vote for (0 to 9).
|
Index of the poll option you want to vote for (0 to 9).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, the :obj:`Poll <pyrogram.Poll>` with the chosen option is returned.
|
:obj:`Poll` - On success, the poll with the chosen option is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
poll = self.get_messages(chat_id, message_id).poll
|
poll = self.get_messages(chat_id, message_id).poll
|
||||||
|
@@ -32,7 +32,7 @@ class ChangeCloudPassword(BaseClient):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
|
"""Use this method to change your Two-Step Verification password (Cloud Password) with a new one.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
current_password (``str``):
|
current_password (``str``):
|
||||||
Your current password.
|
Your current password.
|
||||||
|
|
||||||
@@ -43,11 +43,11 @@ class ChangeCloudPassword(BaseClient):
|
|||||||
A new password hint.
|
A new password hint.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` in case there is no cloud password to change.
|
ValueError: In case there is no cloud password to change.
|
||||||
"""
|
"""
|
||||||
r = self.send(functions.account.GetPassword())
|
r = self.send(functions.account.GetPassword())
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ class EnableCloudPassword(BaseClient):
|
|||||||
|
|
||||||
This password will be asked when you log-in on a new device in addition to the SMS code.
|
This password will be asked when you log-in on a new device in addition to the SMS code.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
password (``str``):
|
password (``str``):
|
||||||
Your password.
|
Your password.
|
||||||
|
|
||||||
@@ -45,11 +45,11 @@ class EnableCloudPassword(BaseClient):
|
|||||||
Recovery e-mail.
|
Recovery e-mail.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` in case there is already a cloud password enabled.
|
ValueError: In case there is already a cloud password enabled.
|
||||||
"""
|
"""
|
||||||
r = self.send(functions.account.GetPassword())
|
r = self.send(functions.account.GetPassword())
|
||||||
|
|
||||||
|
@@ -28,16 +28,16 @@ class RemoveCloudPassword(BaseClient):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
|
"""Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
password (``str``):
|
password (``str``):
|
||||||
Your current password.
|
Your current password.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
``ValueError`` in case there is no cloud password to remove.
|
ValueError: In case there is no cloud password to remove.
|
||||||
"""
|
"""
|
||||||
r = self.send(functions.account.GetPassword())
|
r = self.send(functions.account.GetPassword())
|
||||||
|
|
||||||
|
@@ -31,16 +31,16 @@ class DeleteUserProfilePhotos(BaseClient):
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to delete your own profile photos.
|
"""Use this method to delete your own profile photos.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
id (``str`` | ``list``):
|
id (``str`` | ``list``):
|
||||||
A single :obj:`Photo <pyrogram.Photo>` id as string or multiple ids as list of strings for deleting
|
A single :obj:`Photo` id as string or multiple ids as list of strings for deleting
|
||||||
more than one photos at once.
|
more than one photos at once.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True on success.
|
``bool``: True on success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
id = id if isinstance(id, list) else [id]
|
id = id if isinstance(id, list) else [id]
|
||||||
input_photos = []
|
input_photos = []
|
||||||
|
@@ -26,10 +26,10 @@ class GetMe(BaseClient):
|
|||||||
"""A simple method for testing your authorization. Requires no parameters.
|
"""A simple method for testing your authorization. Requires no parameters.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Basic information about the user or bot in form of a :obj:`User` object
|
:obj:`User`: Basic information about the user or bot.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return pyrogram.User._parse(
|
return pyrogram.User._parse(
|
||||||
self,
|
self,
|
||||||
|
@@ -32,7 +32,7 @@ class GetUserProfilePhotos(BaseClient):
|
|||||||
) -> "pyrogram.UserProfilePhotos":
|
) -> "pyrogram.UserProfilePhotos":
|
||||||
"""Use this method to get a list of profile pictures for a user.
|
"""Use this method to get a list of profile pictures for a user.
|
||||||
|
|
||||||
Args:
|
Parameters:
|
||||||
user_id (``int`` | ``str``):
|
user_id (``int`` | ``str``):
|
||||||
Unique identifier (int) or username (str) of the target chat.
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||||
@@ -47,10 +47,10 @@ class GetUserProfilePhotos(BaseClient):
|
|||||||
Values between 1—100 are accepted. Defaults to 100.
|
Values between 1—100 are accepted. Defaults to 100.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
On success, a :obj:`UserProfilePhotos` object is returned.
|
:obj:`UserProfilePhotos`: On success, an object containing a list of the profile photos is returned.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
return pyrogram.UserProfilePhotos._parse(
|
return pyrogram.UserProfilePhotos._parse(
|
||||||
self,
|
self,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user