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