mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-30 17:43:32 +00:00
Improve type hints
This commit is contained in:
parent
4ebf5cf7e9
commit
32624ef5e6
@ -27,7 +27,7 @@ class {name}(TLObject): # type: ignore
|
|||||||
{read_types}
|
{read_types}
|
||||||
return {name}({return_arguments})
|
return {name}({return_arguments})
|
||||||
|
|
||||||
def write(self) -> bytes:
|
def write(self, *args) -> bytes:
|
||||||
b = BytesIO()
|
b = BytesIO()
|
||||||
b.write(Int(self.ID, False))
|
b.write(Int(self.ID, False))
|
||||||
|
|
||||||
|
@ -21,15 +21,19 @@ import functools
|
|||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from concurrent.futures.thread import ThreadPoolExecutor
|
from concurrent.futures.thread import ThreadPoolExecutor
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
from io import StringIO
|
||||||
|
from mimetypes import MimeTypes
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, List, Optional
|
from typing import Union, List, Optional, Callable
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import __version__, __license__
|
from pyrogram import __version__, __license__
|
||||||
@ -51,12 +55,14 @@ from pyrogram.types import User, TermsOfService
|
|||||||
from pyrogram.utils import ainput
|
from pyrogram.utils import ainput
|
||||||
from .dispatcher import Dispatcher
|
from .dispatcher import Dispatcher
|
||||||
from .file_id import FileId, FileType, ThumbnailSource
|
from .file_id import FileId, FileType, ThumbnailSource
|
||||||
from .scaffold import Scaffold
|
from .mime_types import mime_types
|
||||||
|
from .parser import Parser
|
||||||
|
from .session.internals import MsgId
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Client(Methods, Scaffold):
|
class Client(Methods):
|
||||||
"""Pyrogram Client, the main means for interacting with Telegram.
|
"""Pyrogram Client, the main means for interacting with Telegram.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -177,10 +183,26 @@ class Client(Methods, Scaffold):
|
|||||||
terminal environments.
|
terminal environments.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
APP_VERSION = f"Pyrogram {__version__}"
|
||||||
|
DEVICE_MODEL = f"{platform.python_implementation()} {platform.python_version()}"
|
||||||
|
SYSTEM_VERSION = f"{platform.system()} {platform.release()}"
|
||||||
|
|
||||||
|
LANG_CODE = "en"
|
||||||
|
|
||||||
|
PARENT_DIR = Path(sys.argv[0]).parent
|
||||||
|
|
||||||
|
INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$")
|
||||||
|
WORKERS = min(32, (os.cpu_count() or 0) + 4) # os.cpu_count() can be None
|
||||||
|
WORKDIR = PARENT_DIR
|
||||||
|
CONFIG_FILE = PARENT_DIR / "config.ini"
|
||||||
|
|
||||||
|
mimetypes = MimeTypes()
|
||||||
|
mimetypes.readfp(StringIO(mime_types))
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
session_name: Union[str, Storage],
|
session_name: Union[str, Storage],
|
||||||
api_id: Union[int, str] = None,
|
api_id: int = None,
|
||||||
api_hash: str = None,
|
api_hash: str = None,
|
||||||
app_version: str = None,
|
app_version: str = None,
|
||||||
device_model: str = None,
|
device_model: str = None,
|
||||||
@ -194,9 +216,9 @@ class Client(Methods, Scaffold):
|
|||||||
phone_code: str = None,
|
phone_code: str = None,
|
||||||
password: str = None,
|
password: str = None,
|
||||||
force_sms: bool = False,
|
force_sms: bool = False,
|
||||||
workers: int = Scaffold.WORKERS,
|
workers: int = WORKERS,
|
||||||
workdir: str = Scaffold.WORKDIR,
|
workdir: str = WORKDIR,
|
||||||
config_file: str = Scaffold.CONFIG_FILE,
|
config_file: str = CONFIG_FILE,
|
||||||
plugins: dict = None,
|
plugins: dict = None,
|
||||||
parse_mode: "enums.ParseMode" = enums.ParseMode.DEFAULT,
|
parse_mode: "enums.ParseMode" = enums.ParseMode.DEFAULT,
|
||||||
no_updates: bool = None,
|
no_updates: bool = None,
|
||||||
@ -207,7 +229,7 @@ class Client(Methods, Scaffold):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.session_name = session_name
|
self.session_name = session_name
|
||||||
self.api_id = int(api_id) if api_id else None
|
self.api_id = api_id
|
||||||
self.api_hash = api_hash
|
self.api_hash = api_hash
|
||||||
self.app_version = app_version
|
self.app_version = app_version
|
||||||
self.device_model = device_model
|
self.device_model = device_model
|
||||||
@ -246,6 +268,24 @@ class Client(Methods, Scaffold):
|
|||||||
raise ValueError("Unknown storage engine")
|
raise ValueError("Unknown storage engine")
|
||||||
|
|
||||||
self.dispatcher = Dispatcher(self)
|
self.dispatcher = Dispatcher(self)
|
||||||
|
|
||||||
|
self.rnd_id = MsgId
|
||||||
|
|
||||||
|
self.parser = Parser(self)
|
||||||
|
self.parse_mode = enums.ParseMode.DEFAULT
|
||||||
|
|
||||||
|
self.session = None
|
||||||
|
|
||||||
|
self.media_sessions = {}
|
||||||
|
self.media_sessions_lock = asyncio.Lock()
|
||||||
|
|
||||||
|
self.is_connected = None
|
||||||
|
self.is_initialized = None
|
||||||
|
|
||||||
|
self.takeout_id = None
|
||||||
|
|
||||||
|
self.disconnect_handler = None
|
||||||
|
|
||||||
self.loop = asyncio.get_event_loop()
|
self.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
@ -790,7 +830,7 @@ class Client(Methods, Scaffold):
|
|||||||
self,
|
self,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
file_size: int,
|
file_size: int,
|
||||||
progress: callable,
|
progress: Callable,
|
||||||
progress_args: tuple = ()
|
progress_args: tuple = ()
|
||||||
) -> str:
|
) -> str:
|
||||||
dc_id = file_id.dc_id
|
dc_id = file_id.dc_id
|
||||||
|
@ -127,7 +127,7 @@ def create(func: Callable, name: str = None, **kwargs) -> Filter:
|
|||||||
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.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
func (``callable``):
|
func (``Callable``):
|
||||||
A function that accepts three positional arguments *(filter, client, update)* and returns a boolean: True if the
|
A function that accepts three positional arguments *(filter, client, update)* and returns a boolean: True if the
|
||||||
update should be handled, False otherwise.
|
update should be handled, False otherwise.
|
||||||
The *filter* argument refers to the filter itself and can be used to access keyword arguments (read below).
|
The *filter* argument refers to the filter itself and can be used to access keyword arguments (read below).
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class CallbackQueryHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_callback_query` decorator.
|
:meth:`~pyrogram.Client.on_callback_query` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
@ -43,5 +45,5 @@ class CallbackQueryHandler(Handler):
|
|||||||
The received callback query.
|
The received callback query.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class ChatJoinRequestHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_chat_join_request` decorator.
|
:meth:`~pyrogram.Client.on_chat_join_request` decorator.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``Callable``):
|
||||||
Pass a function that will be called when a new ChatJoinRequest event arrives. It takes
|
Pass a function that will be called when a new ChatJoinRequest event arrives. It takes
|
||||||
*(client, chat_join_request)* as positional arguments (look at the section below for a detailed
|
*(client, chat_join_request)* as positional arguments (look at the section below for a detailed
|
||||||
description).
|
description).
|
||||||
@ -43,5 +45,5 @@ class ChatJoinRequestHandler(Handler):
|
|||||||
The received chat join request.
|
The received chat join request.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class ChatMemberUpdatedHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_chat_member_updated` decorator.
|
:meth:`~pyrogram.Client.on_chat_member_updated` decorator.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``Callable``):
|
||||||
Pass a function that will be called when a new ChatMemberUpdated event arrives. It takes
|
Pass a function that will be called when a new ChatMemberUpdated event arrives. It takes
|
||||||
*(client, chat_member_updated)* as positional arguments (look at the section below for a detailed
|
*(client, chat_member_updated)* as positional arguments (look at the section below for a detailed
|
||||||
description).
|
description).
|
||||||
@ -43,5 +45,5 @@ class ChatMemberUpdatedHandler(Handler):
|
|||||||
The received chat member update.
|
The received chat member update.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class ChosenInlineResultHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_chosen_inline_result` decorator.
|
:meth:`~pyrogram.Client.on_chosen_inline_result` decorator.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``Callable``):
|
||||||
Pass a function that will be called when a new chosen inline result arrives.
|
Pass a function that will be called when a new chosen inline result arrives.
|
||||||
It takes *(client, chosen_inline_result)* as positional arguments (look at the section below for a
|
It takes *(client, chosen_inline_result)* as positional arguments (look at the section below for a
|
||||||
detailed description).
|
detailed description).
|
||||||
@ -44,5 +46,5 @@ class ChosenInlineResultHandler(Handler):
|
|||||||
The received chosen inline result.
|
The received chosen inline result.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -32,7 +32,7 @@ class DeletedMessagesHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_deleted_messages` decorator.
|
:meth:`~pyrogram.Client.on_deleted_messages` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class DisconnectHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_disconnect` decorator.
|
:meth:`~pyrogram.Client.on_disconnect` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
@ -37,5 +39,5 @@ class DisconnectHandler(Handler):
|
|||||||
is established.
|
is established.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable):
|
def __init__(self, callback: Callable):
|
||||||
super().__init__(callback)
|
super().__init__(callback)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class InlineQueryHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_inline_query` decorator.
|
:meth:`~pyrogram.Client.on_inline_query` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
@ -43,5 +45,5 @@ class InlineQueryHandler(Handler):
|
|||||||
The received inline query.
|
The received inline query.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class MessageHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_message` decorator.
|
:meth:`~pyrogram.Client.on_message` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
@ -43,5 +45,5 @@ class MessageHandler(Handler):
|
|||||||
The received message.
|
The received message.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +30,7 @@ class PollHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_poll` decorator.
|
:meth:`~pyrogram.Client.on_poll` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
|
|
||||||
@ -44,5 +46,5 @@ class PollHandler(Handler):
|
|||||||
The received poll.
|
The received poll.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ class RawUpdateHandler(Handler):
|
|||||||
:meth:`~pyrogram.Client.on_raw_update` decorator.
|
:meth:`~pyrogram.Client.on_raw_update` decorator.
|
||||||
|
|
||||||
Parameters:
|
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).
|
||||||
@ -61,5 +63,5 @@ class RawUpdateHandler(Handler):
|
|||||||
- :obj:`~pyrogram.raw.types.ChannelForbidden`
|
- :obj:`~pyrogram.raw.types.ChannelForbidden`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable):
|
def __init__(self, callback: Callable):
|
||||||
super().__init__(callback)
|
super().__init__(callback)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
from .handler import Handler
|
from .handler import Handler
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ class UserStatusHandler(Handler):
|
|||||||
For a nicer way to register this handler, have a look at the :meth:`~pyrogram.Client.on_user_status` decorator.
|
For a nicer way to register this handler, have a look at the :meth:`~pyrogram.Client.on_user_status` decorator.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
callback (``callable``):
|
callback (``Callable``):
|
||||||
Pass a function that will be called when a new user status update arrives. It takes *(client, user)*
|
Pass a function that will be called when a new user status update arrives. It takes *(client, user)*
|
||||||
as positional arguments (look at the section below for a detailed description).
|
as positional arguments (look at the section below for a detailed description).
|
||||||
|
|
||||||
@ -41,5 +43,5 @@ class UserStatusHandler(Handler):
|
|||||||
The user containing the updated status.
|
The user containing the updated status.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, callback: callable, filters=None):
|
def __init__(self, callback: Callable, filters=None):
|
||||||
super().__init__(callback, filters)
|
super().__init__(callback, filters)
|
||||||
|
@ -20,17 +20,17 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.errors import PeerIdInvalid
|
from pyrogram.errors import PeerIdInvalid
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ResolvePeer(Scaffold):
|
class ResolvePeer:
|
||||||
async def resolve_peer(
|
async def resolve_peer(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
peer_id: Union[int, str]
|
peer_id: Union[int, str]
|
||||||
) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]:
|
) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]:
|
||||||
"""Get the InputPeer of a known peer id.
|
"""Get the InputPeer of a known peer id.
|
||||||
|
@ -25,23 +25,23 @@ import math
|
|||||||
import os
|
import os
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from pathlib import PurePath
|
from pathlib import PurePath
|
||||||
from typing import Union, BinaryIO
|
from typing import Union, BinaryIO, Callable
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import StopTransmission
|
from pyrogram import StopTransmission
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.session import Session
|
from pyrogram.session import Session
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SaveFile(Scaffold):
|
class SaveFile:
|
||||||
async def save_file(
|
async def save_file(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
path: Union[str, BinaryIO],
|
path: Union[str, BinaryIO],
|
||||||
file_id: int = None,
|
file_id: int = None,
|
||||||
file_part: int = 0,
|
file_part: int = 0,
|
||||||
progress: callable = None,
|
progress: Callable = None,
|
||||||
progress_args: tuple = ()
|
progress_args: tuple = ()
|
||||||
):
|
):
|
||||||
"""Upload a file onto Telegram servers, without actually sending the message to anyone.
|
"""Upload a file onto Telegram servers, without actually sending the message to anyone.
|
||||||
@ -64,7 +64,7 @@ class SaveFile(Scaffold):
|
|||||||
file_part (``int``, *optional*):
|
file_part (``int``, *optional*):
|
||||||
In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
|
In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
|
||||||
|
|
||||||
progress (``callable``, *optional*):
|
progress (``Callable``, *optional*):
|
||||||
Pass a callback function to view the file transmission progress.
|
Pass a callback function to view the file transmission progress.
|
||||||
The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
|
The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
|
||||||
detailed description) and will be called back each time a new file chunk has been successfully
|
detailed description) and will be called back each time a new file chunk has been successfully
|
||||||
|
@ -18,17 +18,17 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.raw.core import TLObject
|
from pyrogram.raw.core import TLObject
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.session import Session
|
from pyrogram.session import Session
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Send(Scaffold):
|
class Send:
|
||||||
async def send(
|
async def send(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
data: TLObject,
|
data: TLObject,
|
||||||
retries: int = Session.MAX_RETRIES,
|
retries: int = Session.MAX_RETRIES,
|
||||||
timeout: float = Session.WAIT_TIMEOUT,
|
timeout: float = Session.WAIT_TIMEOUT,
|
||||||
|
@ -16,12 +16,15 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class AcceptTermsOfService(Scaffold):
|
class AcceptTermsOfService:
|
||||||
async def accept_terms_of_service(self, terms_of_service_id: str) -> bool:
|
async def accept_terms_of_service(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
terms_of_service_id: str
|
||||||
|
) -> bool:
|
||||||
"""Accept the given terms of service.
|
"""Accept the given terms of service.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,16 +18,19 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.utils import compute_password_check
|
from pyrogram.utils import compute_password_check
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class CheckPassword(Scaffold):
|
class CheckPassword:
|
||||||
async def check_password(self, password: str) -> "types.User":
|
async def check_password(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
password: str
|
||||||
|
) -> "types.User":
|
||||||
"""Check your Two-Step Verification password and log in.
|
"""Check your Two-Step Verification password and log in.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.scaffold import Scaffold
|
import pyrogram
|
||||||
from pyrogram.session import Session
|
from pyrogram.session import Session
|
||||||
|
|
||||||
|
|
||||||
class Connect(Scaffold):
|
class Connect:
|
||||||
async def connect(self) -> bool:
|
async def connect(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
) -> bool:
|
||||||
"""
|
"""
|
||||||
Connect the client to Telegram servers.
|
Connect the client to Telegram servers.
|
||||||
|
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram.scaffold import Scaffold
|
import pyrogram
|
||||||
|
|
||||||
|
|
||||||
class Disconnect(Scaffold):
|
class Disconnect:
|
||||||
async def disconnect(self):
|
async def disconnect(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
):
|
||||||
"""Disconnect the client from Telegram servers.
|
"""Disconnect the client from Telegram servers.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
|
@ -18,14 +18,16 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetPasswordHint(Scaffold):
|
class GetPasswordHint:
|
||||||
async def get_password_hint(self) -> str:
|
async def get_password_hint(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
) -> str:
|
||||||
"""Get your Two-Step Verification password hint.
|
"""Get your Two-Step Verification password hint.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -18,14 +18,16 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyrogram.scaffold import Scaffold
|
import pyrogram
|
||||||
from pyrogram.syncer import Syncer
|
from pyrogram.syncer import Syncer
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Initialize(Scaffold):
|
class Initialize:
|
||||||
async def initialize(self):
|
async def initialize(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
):
|
||||||
"""Initialize the client by starting up workers.
|
"""Initialize the client by starting up workers.
|
||||||
|
|
||||||
This method will start updates and download workers.
|
This method will start updates and download workers.
|
||||||
|
@ -18,14 +18,16 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LogOut(Scaffold):
|
class LogOut:
|
||||||
async def log_out(self):
|
async def log_out(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
):
|
||||||
"""Log out from Telegram and delete the *\\*.session* file.
|
"""Log out from Telegram and delete the *\\*.session* file.
|
||||||
|
|
||||||
When you log out, the current client is stopped and the storage session deleted.
|
When you log out, the current client is stopped and the storage session deleted.
|
||||||
|
@ -18,15 +18,18 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RecoverPassword(Scaffold):
|
class RecoverPassword:
|
||||||
async def recover_password(self, recovery_code: str) -> "types.User":
|
async def recover_password(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
recovery_code: str
|
||||||
|
) -> "types.User":
|
||||||
"""Recover your password with a recovery code and log in.
|
"""Recover your password with a recovery code and log in.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,15 +18,19 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ResendCode(Scaffold):
|
class ResendCode:
|
||||||
async def resend_code(self, phone_number: str, phone_code_hash: str) -> "types.SentCode":
|
async def resend_code(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
phone_number: str,
|
||||||
|
phone_code_hash: str
|
||||||
|
) -> "types.SentCode":
|
||||||
"""Re-send the confirmation code using a different type.
|
"""Re-send the confirmation code using a different type.
|
||||||
|
|
||||||
The type of the code to be re-sent is specified in the *next_type* attribute of the
|
The type of the code to be re-sent is specified in the *next_type* attribute of the
|
||||||
|
@ -18,17 +18,20 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.errors import PhoneMigrate, NetworkMigrate
|
from pyrogram.errors import PhoneMigrate, NetworkMigrate
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.session import Session, Auth
|
from pyrogram.session import Session, Auth
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SendCode(Scaffold):
|
class SendCode:
|
||||||
async def send_code(self, phone_number: str) -> "types.SentCode":
|
async def send_code(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
phone_number: str
|
||||||
|
) -> "types.SentCode":
|
||||||
"""Send the confirmation code to the given phone number.
|
"""Send the confirmation code to the given phone number.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,14 +18,16 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SendRecoveryCode(Scaffold):
|
class SendRecoveryCode:
|
||||||
async def send_recovery_code(self) -> str:
|
async def send_recovery_code(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
) -> str:
|
||||||
"""Send a code to your email to recover your password.
|
"""Send a code to your email to recover your password.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -19,16 +19,16 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SignIn(Scaffold):
|
class SignIn:
|
||||||
async def sign_in(
|
async def sign_in(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
phone_number: str,
|
phone_number: str,
|
||||||
phone_code_hash: str,
|
phone_code_hash: str,
|
||||||
phone_code: str
|
phone_code: str
|
||||||
|
@ -18,17 +18,20 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.errors import UserMigrate
|
from pyrogram.errors import UserMigrate
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.session import Session, Auth
|
from pyrogram.session import Session, Auth
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SignInBot(Scaffold):
|
class SignInBot:
|
||||||
async def sign_in_bot(self, bot_token: str) -> "types.User":
|
async def sign_in_bot(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
bot_token: str
|
||||||
|
) -> "types.User":
|
||||||
"""Authorize a bot using its bot token generated by BotFather.
|
"""Authorize a bot using its bot token generated by BotFather.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,16 +18,16 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SignUp(Scaffold):
|
class SignUp:
|
||||||
async def sign_up(
|
async def sign_up(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
phone_number: str,
|
phone_number: str,
|
||||||
phone_code_hash: str,
|
phone_code_hash: str,
|
||||||
first_name: str,
|
first_name: str,
|
||||||
|
@ -18,15 +18,17 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
from pyrogram.syncer import Syncer
|
from pyrogram.syncer import Syncer
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Terminate(Scaffold):
|
class Terminate:
|
||||||
async def terminate(self):
|
async def terminate(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
):
|
||||||
"""Terminate the client by shutting down workers.
|
"""Terminate the client by shutting down workers.
|
||||||
|
|
||||||
This method does the opposite of :meth:`~pyrogram.Client.initialize`.
|
This method does the opposite of :meth:`~pyrogram.Client.initialize`.
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class AnswerCallbackQuery(Scaffold):
|
class AnswerCallbackQuery:
|
||||||
async def answer_callback_query(
|
async def answer_callback_query(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
callback_query_id: str,
|
callback_query_id: str,
|
||||||
text: str = None,
|
text: str = None,
|
||||||
show_alert: bool = None,
|
show_alert: bool = None,
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class AnswerInlineQuery(Scaffold):
|
class AnswerInlineQuery:
|
||||||
async def answer_inline_query(
|
async def answer_inline_query(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
inline_query_id: str,
|
inline_query_id: str,
|
||||||
results: Iterable["types.InlineQueryResult"],
|
results: Iterable["types.InlineQueryResult"],
|
||||||
cache_time: int = 300,
|
cache_time: int = 300,
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetGameHighScores(Scaffold):
|
class GetGameHighScores:
|
||||||
async def get_game_high_scores(
|
async def get_game_high_scores(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
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
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.errors import UnknownError
|
from pyrogram.errors import UnknownError
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetInlineBotResults(Scaffold):
|
class GetInlineBotResults:
|
||||||
async def get_inline_bot_results(
|
async def get_inline_bot_results(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
bot: Union[int, str],
|
bot: Union[int, str],
|
||||||
query: str = "",
|
query: str = "",
|
||||||
offset: str = "",
|
offset: str = "",
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class RequestCallbackAnswer(Scaffold):
|
class RequestCallbackAnswer:
|
||||||
async def request_callback_answer(
|
async def request_callback_answer(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int,
|
message_id: int,
|
||||||
callback_data: Union[str, bytes],
|
callback_data: Union[str, bytes],
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SendGame(Scaffold):
|
class SendGame:
|
||||||
async def send_game(
|
async def send_game(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
game_short_name: str,
|
game_short_name: str,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SendInlineBotResult(Scaffold):
|
class SendInlineBotResult:
|
||||||
async def send_inline_bot_result(
|
async def send_inline_bot_result(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
query_id: int,
|
query_id: int,
|
||||||
result_id: str,
|
result_id: str,
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
from pyrogram import types
|
||||||
|
|
||||||
|
|
||||||
class SetBotCommands(Scaffold):
|
class SetBotCommands:
|
||||||
async def set_bot_commands(
|
async def set_bot_commands(
|
||||||
self: "pyrogram.Client",
|
self: "pyrogram.Client",
|
||||||
commands: List["types.BotCommand"],
|
commands: List["types.BotCommand"],
|
||||||
@ -31,7 +31,6 @@ class SetBotCommands(Scaffold):
|
|||||||
language_code: str = "",
|
language_code: str = "",
|
||||||
):
|
):
|
||||||
"""Set the list of the bot's commands.
|
"""Set the list of the bot's commands.
|
||||||
|
|
||||||
The commands passed will overwrite any command set previously.
|
The commands passed will overwrite any command set previously.
|
||||||
This method can be used by the own bot only.
|
This method can be used by the own bot only.
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetGameScore(Scaffold):
|
class SetGameScore:
|
||||||
async def set_game_score(
|
async def set_game_score(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
score: int,
|
score: int,
|
||||||
force: bool = None,
|
force: bool = None,
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class AddChatMembers(Scaffold):
|
class AddChatMembers:
|
||||||
async def add_chat_members(
|
async def add_chat_members(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_ids: Union[Union[int, str], List[Union[int, str]]],
|
user_ids: Union[Union[int, str], List[Union[int, str]]],
|
||||||
forward_limit: int = 100
|
forward_limit: int = 100
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class ArchiveChats(Scaffold):
|
class ArchiveChats:
|
||||||
async def archive_chats(
|
async def archive_chats(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_ids: Union[int, str, List[Union[int, str]]],
|
chat_ids: Union[int, str, List[Union[int, str]]],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Archive one or more chats.
|
"""Archive one or more chats.
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, utils
|
from pyrogram import raw, utils
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class BanChatMember(Scaffold):
|
class BanChatMember:
|
||||||
async def ban_chat_member(
|
async def ban_chat_member(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
until_date: datetime = datetime.fromtimestamp(0)
|
until_date: datetime = datetime.fromtimestamp(0)
|
||||||
|
@ -15,15 +15,14 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class CreateChannel(Scaffold):
|
class CreateChannel:
|
||||||
async def create_channel(
|
async def create_channel(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
title: str,
|
title: str,
|
||||||
description: str = ""
|
description: str = ""
|
||||||
) -> "types.Chat":
|
) -> "types.Chat":
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class CreateGroup(Scaffold):
|
class CreateGroup:
|
||||||
async def create_group(
|
async def create_group(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
title: str,
|
title: str,
|
||||||
users: Union[Union[int, str], List[Union[int, str]]]
|
users: Union[Union[int, str], List[Union[int, str]]]
|
||||||
) -> "types.Chat":
|
) -> "types.Chat":
|
||||||
|
@ -15,15 +15,14 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class CreateSupergroup(Scaffold):
|
class CreateSupergroup:
|
||||||
async def create_supergroup(
|
async def create_supergroup(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
title: str,
|
title: str,
|
||||||
description: str = ""
|
description: str = ""
|
||||||
) -> "types.Chat":
|
) -> "types.Chat":
|
||||||
|
@ -18,12 +18,15 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteChannel(Scaffold):
|
class DeleteChannel:
|
||||||
async def delete_channel(self, chat_id: Union[int, str]) -> bool:
|
async def delete_channel(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
chat_id: Union[int, str]
|
||||||
|
) -> bool:
|
||||||
"""Delete a channel.
|
"""Delete a channel.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteChatPhoto(Scaffold):
|
class DeleteChatPhoto:
|
||||||
async def delete_chat_photo(
|
async def delete_chat_photo(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Delete a chat photo.
|
"""Delete a chat photo.
|
||||||
|
@ -18,12 +18,15 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteSupergroup(Scaffold):
|
class DeleteSupergroup:
|
||||||
async def delete_supergroup(self, chat_id: Union[int, str]) -> bool:
|
async def delete_supergroup(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
chat_id: Union[int, str]
|
||||||
|
) -> bool:
|
||||||
"""Delete a supergroup.
|
"""Delete a supergroup.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteUserHistory(Scaffold):
|
class DeleteUserHistory:
|
||||||
async def delete_user_history(
|
async def delete_user_history(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,15 +18,15 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetChat(Scaffold):
|
class GetChat:
|
||||||
async def get_chat(
|
async def get_chat(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> Union["types.Chat", "types.ChatPreview"]:
|
) -> Union["types.Chat", "types.ChatPreview"]:
|
||||||
"""Get up to date information about a chat.
|
"""Get up to date information about a chat.
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union, List, AsyncGenerator, Optional
|
from typing import Union, List, AsyncGenerator, Optional
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetChatEventLog(Scaffold):
|
class GetChatEventLog:
|
||||||
async def get_chat_event_log(
|
async def get_chat_event_log(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
query: str = "",
|
query: str = "",
|
||||||
offset_id: int = 0,
|
offset_id: int = 0,
|
||||||
|
@ -18,15 +18,15 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.errors import UserNotParticipant
|
from pyrogram.errors import UserNotParticipant
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetChatMember(Scaffold):
|
class GetChatMember:
|
||||||
async def get_chat_member(
|
async def get_chat_member(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str]
|
user_id: Union[int, str]
|
||||||
) -> "types.ChatMember":
|
) -> "types.ChatMember":
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, types, enums
|
from pyrogram import raw, types, enums
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetChatMembers(Scaffold):
|
class GetChatMembers:
|
||||||
async def get_chat_members(
|
async def get_chat_members(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
offset: int = 0,
|
offset: int = 0,
|
||||||
limit: int = 200,
|
limit: int = 200,
|
||||||
@ -105,17 +105,17 @@ class GetChatMembers(Scaffold):
|
|||||||
elif isinstance(peer, raw.types.InputPeerChannel):
|
elif isinstance(peer, raw.types.InputPeerChannel):
|
||||||
filter = filter.lower()
|
filter = filter.lower()
|
||||||
|
|
||||||
if filter == Filters.ALL:
|
if filter == enums.ChatMembersFilter.ANY:
|
||||||
filter = raw.types.ChannelParticipantsSearch(q=query)
|
filter = raw.types.ChannelParticipantsSearch(q=query)
|
||||||
elif filter == Filters.BANNED:
|
elif filter == enums.ChatMembersFilter.BANNED:
|
||||||
filter = raw.types.ChannelParticipantsKicked(q=query)
|
filter = raw.types.ChannelParticipantsKicked(q=query)
|
||||||
elif filter == Filters.RESTRICTED:
|
elif filter == enums.ChatMembersFilter.RESTRICTED:
|
||||||
filter = raw.types.ChannelParticipantsBanned(q=query)
|
filter = raw.types.ChannelParticipantsBanned(q=query)
|
||||||
elif filter == Filters.BOTS:
|
elif filter == enums.ChatMembersFilter.BOTS:
|
||||||
filter = raw.types.ChannelParticipantsBots()
|
filter = raw.types.ChannelParticipantsBots()
|
||||||
elif filter == Filters.RECENT:
|
elif filter == enums.ChatMembersFilter.RECENT:
|
||||||
filter = raw.types.ChannelParticipantsRecent()
|
filter = raw.types.ChannelParticipantsRecent()
|
||||||
elif filter == Filters.ADMINISTRATORS:
|
elif filter == enums.ChatMembersFilter.ADMINISTRATORS:
|
||||||
filter = raw.types.ChannelParticipantsAdmins()
|
filter = raw.types.ChannelParticipantsAdmins()
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Invalid filter "{filter}"')
|
raise ValueError(f'Invalid filter "{filter}"')
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetChatMembersCount(Scaffold):
|
class GetChatMembersCount:
|
||||||
async def get_chat_members_count(
|
async def get_chat_members_count(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Get the number of members in a chat.
|
"""Get the number of members in a chat.
|
||||||
|
@ -18,12 +18,15 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetChatOnlineCount(Scaffold):
|
class GetChatOnlineCount:
|
||||||
async def get_chat_online_count(self, chat_id: Union[int, str]) -> int:
|
async def get_chat_online_count(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
chat_id: Union[int, str]
|
||||||
|
) -> int:
|
||||||
"""Get the number of members that are currently online in a chat.
|
"""Get the number of members that are currently online in a chat.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
@ -20,17 +20,17 @@ import logging
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetDialogs(Scaffold):
|
class GetDialogs:
|
||||||
async def get_dialogs(
|
async def get_dialogs(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
offset_date: datetime = datetime.fromtimestamp(0),
|
offset_date: datetime = datetime.fromtimestamp(0),
|
||||||
limit: int = 100,
|
limit: int = 100,
|
||||||
pinned_only: bool = False
|
pinned_only: bool = False
|
||||||
|
@ -16,12 +16,15 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetDialogsCount(Scaffold):
|
class GetDialogsCount:
|
||||||
async def get_dialogs_count(self, pinned_only: bool = False) -> int:
|
async def get_dialogs_count(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
pinned_only: bool = False
|
||||||
|
) -> int:
|
||||||
"""Get the total count of your dialogs.
|
"""Get the total count of your dialogs.
|
||||||
|
|
||||||
pinned_only (``bool``, *optional*):
|
pinned_only (``bool``, *optional*):
|
||||||
|
@ -18,15 +18,15 @@
|
|||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetNearbyChats(Scaffold):
|
class GetNearbyChats:
|
||||||
async def get_nearby_chats(
|
async def get_nearby_chats(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
latitude: float,
|
latitude: float,
|
||||||
longitude: float
|
longitude: float
|
||||||
) -> List["types.Chat"]:
|
) -> List["types.Chat"]:
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetSendAsChats(Scaffold):
|
class GetSendAsChats:
|
||||||
async def get_send_as_chats(
|
async def get_send_as_chats(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> List["types.Chat"]:
|
) -> List["types.Chat"]:
|
||||||
"""Get the list of "send_as" chats available.
|
"""Get the list of "send_as" chats available.
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
from typing import Union, AsyncGenerator, Optional
|
from typing import Union, AsyncGenerator, Optional
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class Filters:
|
class Filters:
|
||||||
@ -32,9 +32,9 @@ class Filters:
|
|||||||
ADMINISTRATORS = "administrators"
|
ADMINISTRATORS = "administrators"
|
||||||
|
|
||||||
|
|
||||||
class IterChatMembers(Scaffold):
|
class IterChatMembers:
|
||||||
async def iter_chat_members(
|
async def iter_chat_members(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
limit: int = 0,
|
limit: int = 0,
|
||||||
query: str = "",
|
query: str = "",
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import AsyncGenerator, Optional
|
from typing import AsyncGenerator, Optional
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import types, raw, utils
|
from pyrogram import types, raw, utils
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class IterDialogs(Scaffold):
|
class IterDialogs:
|
||||||
async def iter_dialogs(
|
async def iter_dialogs(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
limit: int = 0
|
limit: int = 0
|
||||||
) -> Optional[AsyncGenerator["types.Dialog", None]]:
|
) -> Optional[AsyncGenerator["types.Dialog", None]]:
|
||||||
"""Iterate through a user's dialogs sequentially.
|
"""Iterate through a user's dialogs sequentially.
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class JoinChat(Scaffold):
|
class JoinChat:
|
||||||
async def join_chat(
|
async def join_chat(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> "types.Chat":
|
) -> "types.Chat":
|
||||||
"""Join a group chat or channel.
|
"""Join a group chat or channel.
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class LeaveChat(Scaffold):
|
class LeaveChat:
|
||||||
async def leave_chat(
|
async def leave_chat(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
delete: bool = False
|
delete: bool = False
|
||||||
):
|
):
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.raw import functions
|
from pyrogram.raw import functions
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class MarkChatUnread(Scaffold):
|
class MarkChatUnread:
|
||||||
async def mark_chat_unread(
|
async def mark_chat_unread(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Mark a chat as unread.
|
"""Mark a chat as unread.
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw, types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class PinChatMessage(Scaffold):
|
class PinChatMessage:
|
||||||
async def pin_chat_message(
|
async def pin_chat_message(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int,
|
message_id: int,
|
||||||
disable_notification: bool = False,
|
disable_notification: bool = False,
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw, types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class PromoteChatMember(Scaffold):
|
class PromoteChatMember:
|
||||||
async def promote_chat_member(
|
async def promote_chat_member(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
privileges: "types.ChatPrivileges" = types.ChatPrivileges(),
|
privileges: "types.ChatPrivileges" = types.ChatPrivileges(),
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, utils
|
from pyrogram import raw, utils
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class RestrictChatMember(Scaffold):
|
class RestrictChatMember:
|
||||||
async def restrict_chat_member(
|
async def restrict_chat_member(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
permissions: "types.ChatPermissions",
|
permissions: "types.ChatPermissions",
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetAdministratorTitle(Scaffold):
|
class SetAdministratorTitle:
|
||||||
async def set_administrator_title(
|
async def set_administrator_title(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
title: str,
|
title: str,
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatDescription(Scaffold):
|
class SetChatDescription:
|
||||||
async def set_chat_description(
|
async def set_chat_description(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
description: str
|
description: str
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatPermissions(Scaffold):
|
class SetChatPermissions:
|
||||||
async def set_chat_permissions(
|
async def set_chat_permissions(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
permissions: "types.ChatPermissions",
|
permissions: "types.ChatPermissions",
|
||||||
) -> "types.Chat":
|
) -> "types.Chat":
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Union, BinaryIO
|
from typing import Union, BinaryIO
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import utils
|
from pyrogram import utils
|
||||||
from pyrogram.file_id import FileType
|
from pyrogram.file_id import FileType
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatPhoto(Scaffold):
|
class SetChatPhoto:
|
||||||
async def set_chat_photo(
|
async def set_chat_photo(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
*,
|
*,
|
||||||
photo: Union[str, BinaryIO] = None,
|
photo: Union[str, BinaryIO] = None,
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram.raw import functions
|
from pyrogram.raw import functions
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatProtectedContent(Scaffold):
|
class SetChatProtectedContent:
|
||||||
async def set_chat_protected_content(
|
async def set_chat_protected_content(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
enabled: bool
|
enabled: bool
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatTitle(Scaffold):
|
class SetChatTitle:
|
||||||
async def set_chat_title(
|
async def set_chat_title(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
title: str
|
title: str
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union, Optional
|
from typing import Union, Optional
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetChatUsername(Scaffold):
|
class SetChatUsername:
|
||||||
async def set_chat_username(
|
async def set_chat_username(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
username: Optional[str]
|
username: Optional[str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetSendAsChat(Scaffold):
|
class SetSendAsChat:
|
||||||
async def set_send_as_chat(
|
async def set_send_as_chat(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
send_as_chat_id: Union[int, str]
|
send_as_chat_id: Union[int, str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union, Optional
|
from typing import Union, Optional
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class SetSlowMode(Scaffold):
|
class SetSlowMode:
|
||||||
async def set_slow_mode(
|
async def set_slow_mode(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
seconds: Optional[int]
|
seconds: Optional[int]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class UnarchiveChats(Scaffold):
|
class UnarchiveChats:
|
||||||
async def unarchive_chats(
|
async def unarchive_chats(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_ids: Union[int, str, List[Union[int, str]]],
|
chat_ids: Union[int, str, List[Union[int, str]]],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unarchive one or more chats.
|
"""Unarchive one or more chats.
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class UnbanChatMember(Scaffold):
|
class UnbanChatMember:
|
||||||
async def unban_chat_member(
|
async def unban_chat_member(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: Union[int, str]
|
user_id: Union[int, str]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class UnpinAllChatMessages(Scaffold):
|
class UnpinAllChatMessages:
|
||||||
async def unpin_all_chat_messages(
|
async def unpin_all_chat_messages(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to clear the list of pinned messages in a chat.
|
"""Use this method to clear the list of pinned messages in a chat.
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class UnpinChatMessage(Scaffold):
|
class UnpinChatMessage:
|
||||||
async def unpin_chat_message(
|
async def unpin_chat_message(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int = 0
|
message_id: int = 0
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class AddContact(Scaffold):
|
class AddContact:
|
||||||
async def add_contact(
|
async def add_contact(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
first_name: str,
|
first_name: str,
|
||||||
last_name: str = "",
|
last_name: str = "",
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw, types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class DeleteContacts(Scaffold):
|
class DeleteContacts:
|
||||||
async def delete_contacts(
|
async def delete_contacts(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
user_ids: Union[int, str, List[Union[int, str]]]
|
user_ids: Union[int, str, List[Union[int, str]]]
|
||||||
) -> Union["types.User", List["types.User"], None]:
|
) -> Union["types.User", List["types.User"], None]:
|
||||||
"""Delete contacts from your Telegram address book.
|
"""Delete contacts from your Telegram address book.
|
||||||
|
@ -19,15 +19,17 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetContacts(Scaffold):
|
class GetContacts:
|
||||||
async def get_contacts(self) -> List["types.User"]:
|
async def get_contacts(
|
||||||
|
self: "pyrogram.Client"
|
||||||
|
) -> List["types.User"]:
|
||||||
"""Get contacts from your Telegram address book.
|
"""Get contacts from your Telegram address book.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class GetContactsCount(Scaffold):
|
class GetContactsCount:
|
||||||
async def get_contacts_count(self) -> int:
|
async def get_contacts_count(
|
||||||
|
self: "pyrogram.Client"
|
||||||
|
) -> int:
|
||||||
"""Get the total count of contacts from your Telegram address book.
|
"""Get the total count of contacts from your Telegram address book.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class ImportContacts(Scaffold):
|
class ImportContacts:
|
||||||
async def import_contacts(
|
async def import_contacts(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
contacts: List["types.InputPhoneContact"]
|
contacts: List["types.InputPhoneContact"]
|
||||||
):
|
):
|
||||||
"""Import contacts to your Telegram address book.
|
"""Import contacts to your Telegram address book.
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnCallbackQuery(Scaffold):
|
class OnCallbackQuery:
|
||||||
def on_callback_query(
|
def on_callback_query(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling callback queries.
|
"""Decorator for handling callback queries.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnChatJoinRequest(Scaffold):
|
class OnChatJoinRequest:
|
||||||
def on_chat_join_request(
|
def on_chat_join_request(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling chat join requests.
|
"""Decorator for handling chat join requests.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnChatMemberUpdated(Scaffold):
|
class OnChatMemberUpdated:
|
||||||
def on_chat_member_updated(
|
def on_chat_member_updated(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling event changes on chat members.
|
"""Decorator for handling event changes on chat members.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnChosenInlineResult(Scaffold):
|
class OnChosenInlineResult:
|
||||||
def on_chosen_inline_result(
|
def on_chosen_inline_result(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling chosen inline results.
|
"""Decorator for handling chosen inline results.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnDeletedMessages(Scaffold):
|
class OnDeletedMessages:
|
||||||
def on_deleted_messages(
|
def on_deleted_messages(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling deleted messages.
|
"""Decorator for handling deleted messages.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -19,11 +19,10 @@
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnDisconnect(Scaffold):
|
class OnDisconnect:
|
||||||
def on_disconnect(self=None) -> callable:
|
def on_disconnect(self=None) -> Callable:
|
||||||
"""Decorator for handling disconnections.
|
"""Decorator for handling disconnections.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnInlineQuery(Scaffold):
|
class OnInlineQuery:
|
||||||
def on_inline_query(
|
def on_inline_query(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling inline queries.
|
"""Decorator for handling inline queries.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnMessage(Scaffold):
|
class OnMessage:
|
||||||
def on_message(
|
def on_message(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling messages.
|
"""Decorator for handling messages.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnPoll(Scaffold):
|
class OnPoll:
|
||||||
def on_poll(
|
def on_poll(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling poll updates.
|
"""Decorator for handling poll updates.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -19,14 +19,13 @@
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnRawUpdate(Scaffold):
|
class OnRawUpdate:
|
||||||
def on_raw_update(
|
def on_raw_update(
|
||||||
self=None,
|
self=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling raw updates.
|
"""Decorator for handling raw updates.
|
||||||
|
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
|
@ -20,15 +20,14 @@ from typing import Callable
|
|||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.filters import Filter
|
from pyrogram.filters import Filter
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class OnUserStatus(Scaffold):
|
class OnUserStatus:
|
||||||
def on_user_status(
|
def on_user_status(
|
||||||
self=None,
|
self=None,
|
||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> Callable:
|
||||||
"""Decorator for handling user status updates.
|
"""Decorator for handling user status updates.
|
||||||
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
This does the same thing as :meth:`~pyrogram.Client.add_handler` using the
|
||||||
:obj:`~pyrogram.handlers.UserStatusHandler`.
|
:obj:`~pyrogram.handlers.UserStatusHandler`.
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class ApproveChatJoinRequest(Scaffold):
|
class ApproveChatJoinRequest:
|
||||||
async def approve_chat_join_request(
|
async def approve_chat_join_request(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
user_id: int,
|
user_id: int,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
from pyrogram import raw, utils
|
from pyrogram import raw, utils
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
from pyrogram.scaffold import Scaffold
|
|
||||||
|
|
||||||
|
|
||||||
class CreateChatInviteLink(Scaffold):
|
class CreateChatInviteLink:
|
||||||
async def create_chat_invite_link(
|
async def create_chat_invite_link(
|
||||||
self,
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
name: str = None,
|
name: str = None,
|
||||||
expire_date: datetime = None,
|
expire_date: datetime = None,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user