diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py index c433cbd7..2c85c00f 100644 --- a/pyrogram/__init__.py +++ b/pyrogram/__init__.py @@ -35,14 +35,14 @@ class ContinuePropagation(StopAsyncIteration): pass -from asyncio import get_event_loop +import asyncio from . import raw, types, filters, handlers, emoji from .client import Client from .sync import idle # Save the main thread loop for future references -main_event_loop = get_event_loop() +main_event_loop = asyncio.get_event_loop() CRYPTO_EXECUTOR_SIZE_THRESHOLD = 512 diff --git a/pyrogram/client.py b/pyrogram/client.py index 551092ef..a0ea1b10 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -16,19 +16,19 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import asyncio import functools import inspect import logging +import os +import re import shutil import tempfile -from asyncio import get_event_loop from concurrent.futures.thread import ThreadPoolExecutor from configparser import ConfigParser from hashlib import sha256 from importlib import import_module -from os import path, makedirs, remove as os_remove from pathlib import Path -from re import sub as re_sub from typing import Union, List, Optional import pyrogram @@ -182,32 +182,32 @@ class Client(Methods, Scaffold): """ def __init__( - self, - session_name: Union[str, Storage], - api_id: Union[int, str] = None, - api_hash: str = None, - app_version: str = None, - device_model: str = None, - system_version: str = None, - lang_code: str = None, - ipv6: bool = False, - proxy: dict = None, - test_mode: bool = False, - mode: int = 3, - bot_token: str = None, - phone_number: str = None, - 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, - plugins: dict = None, - parse_mode: str = Scaffold.PARSE_MODES[0], - no_updates: bool = None, - takeout: bool = None, - sleep_threshold: int = Session.SLEEP_THRESHOLD, - hide_password: bool = False + self, + session_name: Union[str, Storage], + api_id: Union[int, str] = None, + api_hash: str = None, + app_version: str = None, + device_model: str = None, + system_version: str = None, + lang_code: str = None, + ipv6: bool = False, + proxy: dict = None, + test_mode: bool = False, + mode: int = 3, + bot_token: str = None, + phone_number: str = None, + 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, + plugins: dict = None, + parse_mode: str = Scaffold.PARSE_MODES[0], + no_updates: bool = None, + takeout: bool = None, + sleep_threshold: int = Session.SLEEP_THRESHOLD, + hide_password: bool = False ): super().__init__() @@ -242,7 +242,7 @@ class Client(Methods, Scaffold): if isinstance(session_name, str): if session_name == ":memory:" or len(session_name) >= MemoryStorage.SESSION_STRING_SIZE: - session_name = re_sub(r"[\n\s]+", "", session_name) + session_name = re.sub(r"[\n\s]+", "", session_name) self.storage = MemoryStorage(session_name) else: self.storage = FileStorage(session_name, self.workdir) @@ -252,7 +252,7 @@ class Client(Methods, Scaffold): raise ValueError("Unknown storage engine") self.dispatcher = Dispatcher(self) - self.loop = get_event_loop() + self.loop = asyncio.get_event_loop() def __enter__(self): return self.start() @@ -519,14 +519,14 @@ class Client(Methods, Scaffold): ) if temp_file_path: - final_file_path = path.abspath(re_sub("\\\\", "/", path.join(directory, file_name))) - makedirs(directory, exist_ok=True) + final_file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name))) + os.makedirs(directory, exist_ok=True) shutil.move(temp_file_path, final_file_path) except Exception as e: log.error(e, exc_info=True) try: - os_remove(temp_file_path) + os.remove(temp_file_path) except OSError: pass else: @@ -819,11 +819,11 @@ class Client(Methods, Scaffold): log.warning(f'[{self.session_name}] No plugin loaded from "{root}"') async def get_file( - self, - file_id: FileId, - file_size: int, - progress: callable, - progress_args: tuple = () + self, + file_id: FileId, + file_size: int, + progress: callable, + progress_args: tuple = () ) -> str: dc_id = file_id.dc_id @@ -1049,7 +1049,7 @@ class Client(Methods, Scaffold): log.error(e, exc_info=True) try: - os_remove(file_name) + os.remove(file_name) except OSError: pass diff --git a/pyrogram/errors/rpc_error.py b/pyrogram/errors/rpc_error.py index 500a4201..444447f2 100644 --- a/pyrogram/errors/rpc_error.py +++ b/pyrogram/errors/rpc_error.py @@ -33,11 +33,11 @@ class RPCError(Exception): MESSAGE = "{x}" def __init__( - self, - x: Union[int, str, raw.types.RpcError] = None, - rpc_name: str = None, - is_unknown: bool = False, - is_signed: bool = False + self, + x: Union[int, str, raw.types.RpcError] = None, + rpc_name: str = None, + is_unknown: bool = False, + is_signed: bool = False ): super().__init__("Telegram says: [{}{} {}] - {} {}".format( "-" if is_signed else "", diff --git a/pyrogram/file_id.py b/pyrogram/file_id.py index 68f5f19f..ee1ccc4a 100644 --- a/pyrogram/file_id.py +++ b/pyrogram/file_id.py @@ -154,25 +154,25 @@ class FileId: MINOR = 30 def __init__( - self, *, - major: int = MAJOR, - minor: int = MINOR, - file_type: FileType, - dc_id: int, - file_reference: bytes = b"", - url: str = None, - media_id: int = None, - access_hash: int = None, - volume_id: int = None, - thumbnail_source: ThumbnailSource = None, - thumbnail_file_type: FileType = None, - thumbnail_size: str = "", - secret: int = None, - local_id: int = None, - chat_id: int = None, - chat_access_hash: int = None, - sticker_set_id: int = None, - sticker_set_access_hash: int = None + self, *, + major: int = MAJOR, + minor: int = MINOR, + file_type: FileType, + dc_id: int, + file_reference: bytes = b"", + url: str = None, + media_id: int = None, + access_hash: int = None, + volume_id: int = None, + thumbnail_source: ThumbnailSource = None, + thumbnail_file_type: FileType = None, + thumbnail_size: str = "", + secret: int = None, + local_id: int = None, + chat_id: int = None, + chat_access_hash: int = None, + sticker_set_id: int = None, + sticker_set_access_hash: int = None ): self.major = major self.minor = minor @@ -410,12 +410,12 @@ class FileUniqueType(IntEnum): class FileUniqueId: def __init__( - self, *, - file_unique_type: FileUniqueType, - url: str = None, - media_id: int = None, - volume_id: int = None, - local_id: int = None + self, *, + file_unique_type: FileUniqueType, + url: str = None, + media_id: int = None, + volume_id: int = None, + local_id: int = None ): self.file_unique_type = file_unique_type self.url = url diff --git a/pyrogram/methods/advanced/resolve_peer.py b/pyrogram/methods/advanced/resolve_peer.py index e566dfb1..2a39780c 100644 --- a/pyrogram/methods/advanced/resolve_peer.py +++ b/pyrogram/methods/advanced/resolve_peer.py @@ -30,8 +30,8 @@ log = logging.getLogger(__name__) class ResolvePeer(Scaffold): async def resolve_peer( - self, - peer_id: Union[int, str] + self, + peer_id: Union[int, str] ) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]: """Get the InputPeer of a known peer id. Useful whenever an InputPeer type is required. diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py index 8d1d047f..b612b112 100644 --- a/pyrogram/methods/advanced/save_file.py +++ b/pyrogram/methods/advanced/save_file.py @@ -37,12 +37,12 @@ log = logging.getLogger(__name__) class SaveFile(Scaffold): async def save_file( - self, - path: Union[str, BinaryIO], - file_id: int = None, - file_part: int = 0, - progress: callable = None, - progress_args: tuple = () + self, + path: Union[str, BinaryIO], + file_id: int = None, + file_part: int = 0, + progress: callable = None, + progress_args: tuple = () ): """Upload a file onto Telegram servers, without actually sending the message to anyone. Useful whenever an InputFile type is required. diff --git a/pyrogram/methods/advanced/send.py b/pyrogram/methods/advanced/send.py index f273ed51..8ef0849c 100644 --- a/pyrogram/methods/advanced/send.py +++ b/pyrogram/methods/advanced/send.py @@ -28,11 +28,11 @@ log = logging.getLogger(__name__) class Send(Scaffold): async def send( - self, - data: TLObject, - retries: int = Session.MAX_RETRIES, - timeout: float = Session.WAIT_TIMEOUT, - sleep_threshold: float = None + self, + data: TLObject, + retries: int = Session.MAX_RETRIES, + timeout: float = Session.WAIT_TIMEOUT, + sleep_threshold: float = None ): """Send raw Telegram queries. diff --git a/pyrogram/methods/auth/sign_in.py b/pyrogram/methods/auth/sign_in.py index d3029367..19c0fbc1 100644 --- a/pyrogram/methods/auth/sign_in.py +++ b/pyrogram/methods/auth/sign_in.py @@ -28,10 +28,10 @@ log = logging.getLogger(__name__) class SignIn(Scaffold): async def sign_in( - self, - phone_number: str, - phone_code_hash: str, - phone_code: str + self, + phone_number: str, + phone_code_hash: str, + phone_code: str ) -> Union["types.User", "types.TermsOfService", bool]: """Authorize a user in Telegram with a valid confirmation code. diff --git a/pyrogram/methods/auth/sign_up.py b/pyrogram/methods/auth/sign_up.py index 5c1d9583..4b18a732 100644 --- a/pyrogram/methods/auth/sign_up.py +++ b/pyrogram/methods/auth/sign_up.py @@ -27,11 +27,11 @@ log = logging.getLogger(__name__) class SignUp(Scaffold): async def sign_up( - self, - phone_number: str, - phone_code_hash: str, - first_name: str, - last_name: str = "" + self, + phone_number: str, + phone_code_hash: str, + first_name: str, + last_name: str = "" ) -> "types.User": """Register a new user in Telegram. diff --git a/pyrogram/methods/bots/answer_callback_query.py b/pyrogram/methods/bots/answer_callback_query.py index 9ee810f1..941389b7 100644 --- a/pyrogram/methods/bots/answer_callback_query.py +++ b/pyrogram/methods/bots/answer_callback_query.py @@ -22,12 +22,12 @@ from pyrogram.scaffold import Scaffold class AnswerCallbackQuery(Scaffold): async def answer_callback_query( - self, - callback_query_id: str, - text: str = None, - show_alert: bool = None, - url: str = None, - cache_time: int = 0 + self, + callback_query_id: str, + text: str = None, + show_alert: bool = None, + url: str = None, + cache_time: int = 0 ): """Send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. diff --git a/pyrogram/methods/bots/answer_inline_query.py b/pyrogram/methods/bots/answer_inline_query.py index 06576239..9683e1bb 100644 --- a/pyrogram/methods/bots/answer_inline_query.py +++ b/pyrogram/methods/bots/answer_inline_query.py @@ -25,15 +25,15 @@ from pyrogram.scaffold import Scaffold class AnswerInlineQuery(Scaffold): async def answer_inline_query( - self, - inline_query_id: str, - results: List["types.InlineQueryResult"], - cache_time: int = 300, - is_gallery: bool = False, - is_personal: bool = False, - next_offset: str = "", - switch_pm_text: str = "", - switch_pm_parameter: str = "" + self, + inline_query_id: str, + results: List["types.InlineQueryResult"], + cache_time: int = 300, + is_gallery: bool = False, + is_personal: bool = False, + next_offset: str = "", + switch_pm_text: str = "", + switch_pm_parameter: str = "" ): """Send answers to an inline query. diff --git a/pyrogram/methods/bots/get_game_high_scores.py b/pyrogram/methods/bots/get_game_high_scores.py index 0fac3af6..cd0b09ba 100644 --- a/pyrogram/methods/bots/get_game_high_scores.py +++ b/pyrogram/methods/bots/get_game_high_scores.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class GetGameHighScores(Scaffold): async def get_game_high_scores( - self, - user_id: Union[int, str], - chat_id: Union[int, str], - message_id: int = None + self, + user_id: Union[int, str], + chat_id: Union[int, str], + message_id: int = None ) -> List["types.GameHighScore"]: """Get data for high score tables. diff --git a/pyrogram/methods/bots/get_inline_bot_results.py b/pyrogram/methods/bots/get_inline_bot_results.py index c83f349a..800de93e 100644 --- a/pyrogram/methods/bots/get_inline_bot_results.py +++ b/pyrogram/methods/bots/get_inline_bot_results.py @@ -25,12 +25,12 @@ from pyrogram.scaffold import Scaffold class GetInlineBotResults(Scaffold): async def get_inline_bot_results( - self, - bot: Union[int, str], - query: str = "", - offset: str = "", - latitude: float = None, - longitude: float = None + self, + bot: Union[int, str], + query: str = "", + offset: str = "", + latitude: float = None, + longitude: float = None ): """Get bot results via inline queries. You can then send a result using :meth:`~pyrogram.Client.send_inline_bot_result` diff --git a/pyrogram/methods/bots/request_callback_answer.py b/pyrogram/methods/bots/request_callback_answer.py index 4e8b16f9..5db9dfe0 100644 --- a/pyrogram/methods/bots/request_callback_answer.py +++ b/pyrogram/methods/bots/request_callback_answer.py @@ -24,11 +24,11 @@ from pyrogram.scaffold import Scaffold class RequestCallbackAnswer(Scaffold): async def request_callback_answer( - self, - chat_id: Union[int, str], - message_id: int, - callback_data: Union[str, bytes], - timeout: int = 10 + self, + chat_id: Union[int, str], + message_id: int, + callback_data: Union[str, bytes], + timeout: int = 10 ): """Request a callback answer from bots. This is the equivalent of clicking an inline button containing callback data. diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 640be846..05b9094f 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -25,18 +25,18 @@ from pyrogram.scaffold import Scaffold class SendGame(Scaffold): async def send_game( - self, - chat_id: Union[int, str], - game_short_name: str, - disable_notification: bool = None, - reply_to_message_id: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + game_short_name: str, + disable_notification: bool = None, + reply_to_message_id: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send a game. diff --git a/pyrogram/methods/bots/send_inline_bot_result.py b/pyrogram/methods/bots/send_inline_bot_result.py index 2c623f16..de00546c 100644 --- a/pyrogram/methods/bots/send_inline_bot_result.py +++ b/pyrogram/methods/bots/send_inline_bot_result.py @@ -24,13 +24,13 @@ from pyrogram.scaffold import Scaffold class SendInlineBotResult(Scaffold): async def send_inline_bot_result( - self, - chat_id: Union[int, str], - query_id: int, - result_id: str, - disable_notification: bool = None, - reply_to_message_id: int = None, - hide_via: bool = None + self, + chat_id: Union[int, str], + query_id: int, + result_id: str, + disable_notification: bool = None, + reply_to_message_id: int = None, + hide_via: bool = None ): """Send an inline bot result. Bot results can be retrieved using :meth:`~pyrogram.Client.get_inline_bot_results` diff --git a/pyrogram/methods/bots/set_game_score.py b/pyrogram/methods/bots/set_game_score.py index 0ddcf2f0..edb38dcf 100644 --- a/pyrogram/methods/bots/set_game_score.py +++ b/pyrogram/methods/bots/set_game_score.py @@ -25,13 +25,13 @@ from pyrogram.scaffold import Scaffold class SetGameScore(Scaffold): async def set_game_score( - self, - user_id: Union[int, str], - score: int, - force: bool = None, - disable_edit_message: bool = None, - chat_id: Union[int, str] = None, - message_id: int = None + self, + user_id: Union[int, str], + score: int, + force: bool = None, + disable_edit_message: bool = None, + chat_id: Union[int, str] = None, + message_id: int = None ) -> Union["types.Message", bool]: # inline_message_id: str = None): TODO Add inline_message_id """Set the score of the specified user in a game. diff --git a/pyrogram/methods/chats/add_chat_members.py b/pyrogram/methods/chats/add_chat_members.py index d5423f40..70fb0f97 100644 --- a/pyrogram/methods/chats/add_chat_members.py +++ b/pyrogram/methods/chats/add_chat_members.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class AddChatMembers(Scaffold): async def add_chat_members( - self, - chat_id: Union[int, str], - user_ids: Union[Union[int, str], List[Union[int, str]]], - forward_limit: int = 100 + self, + chat_id: Union[int, str], + user_ids: Union[Union[int, str], List[Union[int, str]]], + forward_limit: int = 100 ) -> bool: """Add new chat members to a group, supergroup or channel diff --git a/pyrogram/methods/chats/archive_chats.py b/pyrogram/methods/chats/archive_chats.py index caa6de97..c65b7622 100644 --- a/pyrogram/methods/chats/archive_chats.py +++ b/pyrogram/methods/chats/archive_chats.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class ArchiveChats(Scaffold): async def archive_chats( - self, - chat_ids: Union[int, str, List[Union[int, str]]], + self, + chat_ids: Union[int, str, List[Union[int, str]]], ) -> bool: """Archive one or more chats. diff --git a/pyrogram/methods/chats/ban_chat_member.py b/pyrogram/methods/chats/ban_chat_member.py index 9163afe2..bdf11751 100644 --- a/pyrogram/methods/chats/ban_chat_member.py +++ b/pyrogram/methods/chats/ban_chat_member.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class BanChatMember(Scaffold): async def ban_chat_member( - self, - chat_id: Union[int, str], - user_id: Union[int, str], - until_date: int = 0 + self, + chat_id: Union[int, str], + user_id: Union[int, str], + until_date: int = 0 ) -> Union["types.Message", bool]: """Ban a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using diff --git a/pyrogram/methods/chats/create_channel.py b/pyrogram/methods/chats/create_channel.py index 2ea66548..b3b21eae 100644 --- a/pyrogram/methods/chats/create_channel.py +++ b/pyrogram/methods/chats/create_channel.py @@ -23,9 +23,9 @@ from pyrogram.scaffold import Scaffold class CreateChannel(Scaffold): async def create_channel( - self, - title: str, - description: str = "" + self, + title: str, + description: str = "" ) -> "types.Chat": """Create a new broadcast channel. diff --git a/pyrogram/methods/chats/create_group.py b/pyrogram/methods/chats/create_group.py index 30bd7625..2117d369 100644 --- a/pyrogram/methods/chats/create_group.py +++ b/pyrogram/methods/chats/create_group.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class CreateGroup(Scaffold): async def create_group( - self, - title: str, - users: Union[Union[int, str], List[Union[int, str]]] + self, + title: str, + users: Union[Union[int, str], List[Union[int, str]]] ) -> "types.Chat": """Create a new basic group. diff --git a/pyrogram/methods/chats/create_supergroup.py b/pyrogram/methods/chats/create_supergroup.py index 87b53b3d..2c72e25b 100644 --- a/pyrogram/methods/chats/create_supergroup.py +++ b/pyrogram/methods/chats/create_supergroup.py @@ -23,9 +23,9 @@ from pyrogram.scaffold import Scaffold class CreateSupergroup(Scaffold): async def create_supergroup( - self, - title: str, - description: str = "" + self, + title: str, + description: str = "" ) -> "types.Chat": """Create a new supergroup. diff --git a/pyrogram/methods/chats/delete_chat_photo.py b/pyrogram/methods/chats/delete_chat_photo.py index a953ff56..4311658b 100644 --- a/pyrogram/methods/chats/delete_chat_photo.py +++ b/pyrogram/methods/chats/delete_chat_photo.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class DeleteChatPhoto(Scaffold): async def delete_chat_photo( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ) -> bool: """Delete a chat photo. diff --git a/pyrogram/methods/chats/delete_user_history.py b/pyrogram/methods/chats/delete_user_history.py index 2a397e23..ca9d0c59 100644 --- a/pyrogram/methods/chats/delete_user_history.py +++ b/pyrogram/methods/chats/delete_user_history.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class DeleteUserHistory(Scaffold): async def delete_user_history( - self, - chat_id: Union[int, str], - user_id: Union[int, str], + self, + chat_id: Union[int, str], + user_id: Union[int, str], ) -> bool: """Delete all messages sent by a certain user in a supergroup. diff --git a/pyrogram/methods/chats/get_chat.py b/pyrogram/methods/chats/get_chat.py index 0439b58d..d9ecb166 100644 --- a/pyrogram/methods/chats/get_chat.py +++ b/pyrogram/methods/chats/get_chat.py @@ -26,8 +26,8 @@ from pyrogram.scaffold import Scaffold class GetChat(Scaffold): async def get_chat( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ) -> Union["types.Chat", "types.ChatPreview"]: """Get up to date information about a chat. diff --git a/pyrogram/methods/chats/get_chat_event_log.py b/pyrogram/methods/chats/get_chat_event_log.py index 32d07b1f..3e392a20 100644 --- a/pyrogram/methods/chats/get_chat_event_log.py +++ b/pyrogram/methods/chats/get_chat_event_log.py @@ -25,13 +25,13 @@ from pyrogram.scaffold import Scaffold class GetChatEventLog(Scaffold): async def get_chat_event_log( - self, - chat_id: Union[int, str], - query: str = "", - offset_id: int = 0, - limit: int = 0, - filters: "types.ChatEventFilter" = None, - user_ids: List[Union[int, str]] = None + self, + chat_id: Union[int, str], + query: str = "", + offset_id: int = 0, + limit: int = 0, + filters: "types.ChatEventFilter" = None, + user_ids: List[Union[int, str]] = None ) -> Optional[AsyncGenerator["types.ChatEvent", None]]: """Get the actions taken by chat members and administrators in the last 48h. diff --git a/pyrogram/methods/chats/get_chat_member.py b/pyrogram/methods/chats/get_chat_member.py index 0608d42a..9987327c 100644 --- a/pyrogram/methods/chats/get_chat_member.py +++ b/pyrogram/methods/chats/get_chat_member.py @@ -26,9 +26,9 @@ from pyrogram.scaffold import Scaffold class GetChatMember(Scaffold): async def get_chat_member( - self, - chat_id: Union[int, str], - user_id: Union[int, str] + self, + chat_id: Union[int, str], + user_id: Union[int, str] ) -> "types.ChatMember": """Get information about one member of a chat. diff --git a/pyrogram/methods/chats/get_chat_members.py b/pyrogram/methods/chats/get_chat_members.py index 49fc70eb..c2d35e4c 100644 --- a/pyrogram/methods/chats/get_chat_members.py +++ b/pyrogram/methods/chats/get_chat_members.py @@ -37,12 +37,12 @@ class Filters: class GetChatMembers(Scaffold): async def get_chat_members( - self, - chat_id: Union[int, str], - offset: int = 0, - limit: int = 200, - query: str = "", - filter: str = Filters.RECENT + self, + chat_id: Union[int, str], + offset: int = 0, + limit: int = 200, + query: str = "", + filter: str = Filters.RECENT ) -> List["types.ChatMember"]: """Get a chunk of the members list of a chat. diff --git a/pyrogram/methods/chats/get_chat_members_count.py b/pyrogram/methods/chats/get_chat_members_count.py index 2349ed3d..aa943eea 100644 --- a/pyrogram/methods/chats/get_chat_members_count.py +++ b/pyrogram/methods/chats/get_chat_members_count.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class GetChatMembersCount(Scaffold): async def get_chat_members_count( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ) -> int: """Get the number of members in a chat. diff --git a/pyrogram/methods/chats/get_dialogs.py b/pyrogram/methods/chats/get_dialogs.py index 2152e200..7a9d6a48 100644 --- a/pyrogram/methods/chats/get_dialogs.py +++ b/pyrogram/methods/chats/get_dialogs.py @@ -29,10 +29,10 @@ log = logging.getLogger(__name__) class GetDialogs(Scaffold): async def get_dialogs( - self, - offset_date: int = 0, - limit: int = 100, - pinned_only: bool = False + self, + offset_date: int = 0, + limit: int = 100, + pinned_only: bool = False ) -> List["types.Dialog"]: """Get a chunk of the user's dialogs. diff --git a/pyrogram/methods/chats/get_nearby_chats.py b/pyrogram/methods/chats/get_nearby_chats.py index 43229b8a..dcceb439 100644 --- a/pyrogram/methods/chats/get_nearby_chats.py +++ b/pyrogram/methods/chats/get_nearby_chats.py @@ -26,9 +26,9 @@ from pyrogram.scaffold import Scaffold class GetNearbyChats(Scaffold): async def get_nearby_chats( - self, - latitude: float, - longitude: float + self, + latitude: float, + longitude: float ) -> List["types.Chat"]: """Get nearby chats. diff --git a/pyrogram/methods/chats/get_send_as_chats.py b/pyrogram/methods/chats/get_send_as_chats.py index 2beefc56..4d2fae48 100644 --- a/pyrogram/methods/chats/get_send_as_chats.py +++ b/pyrogram/methods/chats/get_send_as_chats.py @@ -25,8 +25,8 @@ from pyrogram.scaffold import Scaffold class GetSendAsChats(Scaffold): async def get_send_as_chats( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ) -> List["types.Chat"]: """Get the list of "send_as" chats available. diff --git a/pyrogram/methods/chats/iter_chat_members.py b/pyrogram/methods/chats/iter_chat_members.py index 28fd4f23..e9fa5b82 100644 --- a/pyrogram/methods/chats/iter_chat_members.py +++ b/pyrogram/methods/chats/iter_chat_members.py @@ -34,11 +34,11 @@ class Filters: class IterChatMembers(Scaffold): async def iter_chat_members( - self, - chat_id: Union[int, str], - limit: int = 0, - query: str = "", - filter: str = Filters.RECENT + self, + chat_id: Union[int, str], + limit: int = 0, + query: str = "", + filter: str = Filters.RECENT ) -> Optional[AsyncGenerator["types.ChatMember", None]]: """Iterate through the members of a chat sequentially. diff --git a/pyrogram/methods/chats/iter_dialogs.py b/pyrogram/methods/chats/iter_dialogs.py index 3976e6d5..2584d98d 100644 --- a/pyrogram/methods/chats/iter_dialogs.py +++ b/pyrogram/methods/chats/iter_dialogs.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class IterDialogs(Scaffold): async def iter_dialogs( - self, - limit: int = 0 + self, + limit: int = 0 ) -> Optional[AsyncGenerator["types.Dialog", None]]: """Iterate through a user's dialogs sequentially. diff --git a/pyrogram/methods/chats/join_chat.py b/pyrogram/methods/chats/join_chat.py index dc4a882e..ca720d6d 100644 --- a/pyrogram/methods/chats/join_chat.py +++ b/pyrogram/methods/chats/join_chat.py @@ -25,8 +25,8 @@ from pyrogram.scaffold import Scaffold class JoinChat(Scaffold): async def join_chat( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ): """Join a group chat or channel. diff --git a/pyrogram/methods/chats/leave_chat.py b/pyrogram/methods/chats/leave_chat.py index 91dbefaa..3271a1f9 100644 --- a/pyrogram/methods/chats/leave_chat.py +++ b/pyrogram/methods/chats/leave_chat.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class LeaveChat(Scaffold): async def leave_chat( - self, - chat_id: Union[int, str], - delete: bool = False + self, + chat_id: Union[int, str], + delete: bool = False ): """Leave a group chat or channel. diff --git a/pyrogram/methods/chats/mark_chat_unread.py b/pyrogram/methods/chats/mark_chat_unread.py index c3948d0f..4a48c5d6 100644 --- a/pyrogram/methods/chats/mark_chat_unread.py +++ b/pyrogram/methods/chats/mark_chat_unread.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class MarkChatUnread(Scaffold): async def mark_chat_unread( - self, - chat_id: Union[int, str], + self, + chat_id: Union[int, str], ) -> bool: """Mark a chat as unread. diff --git a/pyrogram/methods/chats/pin_chat_message.py b/pyrogram/methods/chats/pin_chat_message.py index 1bc584d2..d4d6b040 100644 --- a/pyrogram/methods/chats/pin_chat_message.py +++ b/pyrogram/methods/chats/pin_chat_message.py @@ -24,11 +24,11 @@ from pyrogram.scaffold import Scaffold class PinChatMessage(Scaffold): async def pin_chat_message( - self, - chat_id: Union[int, str], - message_id: int, - disable_notification: bool = False, - both_sides: bool = False, + self, + chat_id: Union[int, str], + message_id: int, + disable_notification: bool = False, + both_sides: bool = False, ) -> bool: """Pin a message in a group, channel or your own chat. You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in diff --git a/pyrogram/methods/chats/promote_chat_member.py b/pyrogram/methods/chats/promote_chat_member.py index 41eda86c..8ab5fe29 100644 --- a/pyrogram/methods/chats/promote_chat_member.py +++ b/pyrogram/methods/chats/promote_chat_member.py @@ -24,20 +24,20 @@ from pyrogram.scaffold import Scaffold class PromoteChatMember(Scaffold): async def promote_chat_member( - self, - chat_id: Union[int, str], - user_id: Union[int, str], - is_anonymous: bool = False, - can_manage_chat: bool = True, - can_change_info: bool = False, - can_post_messages: bool = False, - can_edit_messages: bool = False, - can_delete_messages: bool = False, - can_restrict_members: bool = False, - can_invite_users: bool = False, - can_pin_messages: bool = False, - can_promote_members: bool = False, - can_manage_voice_chats: bool = False + self, + chat_id: Union[int, str], + user_id: Union[int, str], + is_anonymous: bool = False, + can_manage_chat: bool = True, + can_change_info: bool = False, + can_post_messages: bool = False, + can_edit_messages: bool = False, + can_delete_messages: bool = False, + can_restrict_members: bool = False, + can_invite_users: bool = False, + can_pin_messages: bool = False, + can_promote_members: bool = False, + can_manage_voice_chats: bool = False ) -> bool: """Promote or demote a user in a supergroup or a channel. diff --git a/pyrogram/methods/chats/restrict_chat_member.py b/pyrogram/methods/chats/restrict_chat_member.py index 96f8ff5c..7c74d685 100644 --- a/pyrogram/methods/chats/restrict_chat_member.py +++ b/pyrogram/methods/chats/restrict_chat_member.py @@ -25,11 +25,11 @@ from pyrogram.scaffold import Scaffold class RestrictChatMember(Scaffold): async def restrict_chat_member( - self, - chat_id: Union[int, str], - user_id: Union[int, str], - permissions: "types.ChatPermissions", - until_date: int = 0 + self, + chat_id: Union[int, str], + user_id: Union[int, str], + permissions: "types.ChatPermissions", + until_date: int = 0 ) -> "types.Chat": """Restrict a user in a supergroup. diff --git a/pyrogram/methods/chats/set_administrator_title.py b/pyrogram/methods/chats/set_administrator_title.py index 39fccb79..382d1fac 100644 --- a/pyrogram/methods/chats/set_administrator_title.py +++ b/pyrogram/methods/chats/set_administrator_title.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class SetAdministratorTitle(Scaffold): async def set_administrator_title( - self, - chat_id: Union[int, str], - user_id: Union[int, str], - title: str, + self, + chat_id: Union[int, str], + user_id: Union[int, str], + title: str, ) -> bool: """Set a custom title (rank) to an administrator of a supergroup. diff --git a/pyrogram/methods/chats/set_chat_description.py b/pyrogram/methods/chats/set_chat_description.py index 81a3a82e..6d2575f2 100644 --- a/pyrogram/methods/chats/set_chat_description.py +++ b/pyrogram/methods/chats/set_chat_description.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class SetChatDescription(Scaffold): async def set_chat_description( - self, - chat_id: Union[int, str], - description: str + self, + chat_id: Union[int, str], + description: str ) -> bool: """Change the description of a supergroup or a channel. You must be an administrator in the chat for this to work and must have the appropriate admin rights. diff --git a/pyrogram/methods/chats/set_chat_permissions.py b/pyrogram/methods/chats/set_chat_permissions.py index be94ee29..2ff2b678 100644 --- a/pyrogram/methods/chats/set_chat_permissions.py +++ b/pyrogram/methods/chats/set_chat_permissions.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class SetChatPermissions(Scaffold): async def set_chat_permissions( - self, - chat_id: Union[int, str], - permissions: "types.ChatPermissions", + self, + chat_id: Union[int, str], + permissions: "types.ChatPermissions", ) -> "types.Chat": """Set default chat permissions for all members. diff --git a/pyrogram/methods/chats/set_chat_photo.py b/pyrogram/methods/chats/set_chat_photo.py index 3224e574..266253d6 100644 --- a/pyrogram/methods/chats/set_chat_photo.py +++ b/pyrogram/methods/chats/set_chat_photo.py @@ -27,11 +27,11 @@ from pyrogram.scaffold import Scaffold class SetChatPhoto(Scaffold): async def set_chat_photo( - self, - chat_id: Union[int, str], - *, - photo: Union[str, BinaryIO] = None, - video: Union[str, BinaryIO] = None + self, + chat_id: Union[int, str], + *, + photo: Union[str, BinaryIO] = None, + video: Union[str, BinaryIO] = None ) -> bool: """Set a new chat photo or video (H.264/MPEG-4 AVC video, max 5 seconds). diff --git a/pyrogram/methods/chats/set_chat_protected_content.py b/pyrogram/methods/chats/set_chat_protected_content.py index ca676837..d63e381d 100644 --- a/pyrogram/methods/chats/set_chat_protected_content.py +++ b/pyrogram/methods/chats/set_chat_protected_content.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class SetChatProtectedContent(Scaffold): async def set_chat_protected_content( - self, - chat_id: Union[int, str], - enabled: bool + self, + chat_id: Union[int, str], + enabled: bool ) -> bool: """Set the chat protected content setting. diff --git a/pyrogram/methods/chats/set_chat_title.py b/pyrogram/methods/chats/set_chat_title.py index 885d0d3f..62649f38 100644 --- a/pyrogram/methods/chats/set_chat_title.py +++ b/pyrogram/methods/chats/set_chat_title.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class SetChatTitle(Scaffold): async def set_chat_title( - self, - chat_id: Union[int, str], - title: str + self, + chat_id: Union[int, str], + title: str ) -> bool: """Change the title of a chat. Titles can't be changed for private chats. diff --git a/pyrogram/methods/chats/set_send_as_chat.py b/pyrogram/methods/chats/set_send_as_chat.py index 13f12ee8..3fc686bb 100644 --- a/pyrogram/methods/chats/set_send_as_chat.py +++ b/pyrogram/methods/chats/set_send_as_chat.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class SetSendAsChat(Scaffold): async def set_send_as_chat( - self, - chat_id: Union[int, str], - send_as_chat_id: Union[int, str] + self, + chat_id: Union[int, str], + send_as_chat_id: Union[int, str] ) -> bool: """Set the default "send_as" chat for a chat. diff --git a/pyrogram/methods/chats/set_slow_mode.py b/pyrogram/methods/chats/set_slow_mode.py index beec8923..7e6739ba 100644 --- a/pyrogram/methods/chats/set_slow_mode.py +++ b/pyrogram/methods/chats/set_slow_mode.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class SetSlowMode(Scaffold): async def set_slow_mode( - self, - chat_id: Union[int, str], - seconds: Optional[int] + self, + chat_id: Union[int, str], + seconds: Optional[int] ) -> bool: """Set the slow mode interval for a chat. diff --git a/pyrogram/methods/chats/unarchive_chats.py b/pyrogram/methods/chats/unarchive_chats.py index 016bda46..32867798 100644 --- a/pyrogram/methods/chats/unarchive_chats.py +++ b/pyrogram/methods/chats/unarchive_chats.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class UnarchiveChats(Scaffold): async def unarchive_chats( - self, - chat_ids: Union[int, str, List[Union[int, str]]], + self, + chat_ids: Union[int, str, List[Union[int, str]]], ) -> bool: """Unarchive one or more chats. diff --git a/pyrogram/methods/chats/unban_chat_member.py b/pyrogram/methods/chats/unban_chat_member.py index 77248a86..c7be7b58 100644 --- a/pyrogram/methods/chats/unban_chat_member.py +++ b/pyrogram/methods/chats/unban_chat_member.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class UnbanChatMember(Scaffold): async def unban_chat_member( - self, - chat_id: Union[int, str], - user_id: Union[int, str] + self, + chat_id: Union[int, str], + user_id: Union[int, str] ) -> bool: """Unban a previously banned user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. diff --git a/pyrogram/methods/chats/unpin_all_chat_messages.py b/pyrogram/methods/chats/unpin_all_chat_messages.py index d8b7a3df..3028120a 100644 --- a/pyrogram/methods/chats/unpin_all_chat_messages.py +++ b/pyrogram/methods/chats/unpin_all_chat_messages.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class UnpinAllChatMessages(Scaffold): async def unpin_all_chat_messages( - self, - chat_id: Union[int, str], + self, + chat_id: Union[int, str], ) -> bool: """Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have diff --git a/pyrogram/methods/chats/unpin_chat_message.py b/pyrogram/methods/chats/unpin_chat_message.py index 8f7993a8..83654452 100644 --- a/pyrogram/methods/chats/unpin_chat_message.py +++ b/pyrogram/methods/chats/unpin_chat_message.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class UnpinChatMessage(Scaffold): async def unpin_chat_message( - self, - chat_id: Union[int, str], - message_id: int = 0 + self, + chat_id: Union[int, str], + message_id: int = 0 ) -> bool: """Unpin a message in a group, channel or your own chat. You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin diff --git a/pyrogram/methods/chats/update_chat_username.py b/pyrogram/methods/chats/update_chat_username.py index 2e44a142..a5bf9958 100644 --- a/pyrogram/methods/chats/update_chat_username.py +++ b/pyrogram/methods/chats/update_chat_username.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class UpdateChatUsername(Scaffold): async def update_chat_username( - self, - chat_id: Union[int, str], - username: Optional[str] + self, + chat_id: Union[int, str], + username: Optional[str] ) -> bool: """Update a channel or a supergroup username. diff --git a/pyrogram/methods/contacts/add_contact.py b/pyrogram/methods/contacts/add_contact.py index 45aecb80..cceb273d 100644 --- a/pyrogram/methods/contacts/add_contact.py +++ b/pyrogram/methods/contacts/add_contact.py @@ -25,12 +25,12 @@ from pyrogram.scaffold import Scaffold class AddContact(Scaffold): async def add_contact( - self, - user_id: Union[int, str], - first_name: str, - last_name: str = "", - phone_number: str = "", - share_phone_number: bool = False + self, + user_id: Union[int, str], + first_name: str, + last_name: str = "", + phone_number: str = "", + share_phone_number: bool = False ): """Add an existing Telegram user as contact, even without a phone number. diff --git a/pyrogram/methods/contacts/delete_contacts.py b/pyrogram/methods/contacts/delete_contacts.py index 05caffd2..27340747 100644 --- a/pyrogram/methods/contacts/delete_contacts.py +++ b/pyrogram/methods/contacts/delete_contacts.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class DeleteContacts(Scaffold): async def delete_contacts( - self, - user_ids: Union[int, str, List[Union[int, str]]] + self, + user_ids: Union[int, str, List[Union[int, str]]] ) -> Union["types.User", List["types.User"], None]: """Delete contacts from your Telegram address book. diff --git a/pyrogram/methods/contacts/import_contacts.py b/pyrogram/methods/contacts/import_contacts.py index 3007574d..b7df8554 100644 --- a/pyrogram/methods/contacts/import_contacts.py +++ b/pyrogram/methods/contacts/import_contacts.py @@ -25,8 +25,8 @@ from pyrogram.scaffold import Scaffold class ImportContacts(Scaffold): async def import_contacts( - self, - contacts: List["types.InputPhoneContact"] + self, + contacts: List["types.InputPhoneContact"] ): """Import contacts to your Telegram address book. diff --git a/pyrogram/methods/decorators/on_callback_query.py b/pyrogram/methods/decorators/on_callback_query.py index 59466cc8..fb0b716f 100644 --- a/pyrogram/methods/decorators/on_callback_query.py +++ b/pyrogram/methods/decorators/on_callback_query.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnCallbackQuery(Scaffold): def on_callback_query( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling callback queries. diff --git a/pyrogram/methods/decorators/on_chat_join_request.py b/pyrogram/methods/decorators/on_chat_join_request.py index 3542fbc4..06299018 100644 --- a/pyrogram/methods/decorators/on_chat_join_request.py +++ b/pyrogram/methods/decorators/on_chat_join_request.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnChatJoinRequest(Scaffold): def on_chat_join_request( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling chat join requests. diff --git a/pyrogram/methods/decorators/on_chat_member_updated.py b/pyrogram/methods/decorators/on_chat_member_updated.py index 6552cd2b..9c10debf 100644 --- a/pyrogram/methods/decorators/on_chat_member_updated.py +++ b/pyrogram/methods/decorators/on_chat_member_updated.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnChatMemberUpdated(Scaffold): def on_chat_member_updated( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling event changes on chat members. diff --git a/pyrogram/methods/decorators/on_chosen_inline_result.py b/pyrogram/methods/decorators/on_chosen_inline_result.py index fb46409a..a2775c9b 100644 --- a/pyrogram/methods/decorators/on_chosen_inline_result.py +++ b/pyrogram/methods/decorators/on_chosen_inline_result.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnChosenInlineResult(Scaffold): def on_chosen_inline_result( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling chosen inline results. diff --git a/pyrogram/methods/decorators/on_deleted_messages.py b/pyrogram/methods/decorators/on_deleted_messages.py index 20dc8c79..3bf88b08 100644 --- a/pyrogram/methods/decorators/on_deleted_messages.py +++ b/pyrogram/methods/decorators/on_deleted_messages.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnDeletedMessages(Scaffold): def on_deleted_messages( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling deleted messages. diff --git a/pyrogram/methods/decorators/on_inline_query.py b/pyrogram/methods/decorators/on_inline_query.py index 040bbd66..4910670e 100644 --- a/pyrogram/methods/decorators/on_inline_query.py +++ b/pyrogram/methods/decorators/on_inline_query.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnInlineQuery(Scaffold): def on_inline_query( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling inline queries. diff --git a/pyrogram/methods/decorators/on_message.py b/pyrogram/methods/decorators/on_message.py index b206f511..634ca2e3 100644 --- a/pyrogram/methods/decorators/on_message.py +++ b/pyrogram/methods/decorators/on_message.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnMessage(Scaffold): def on_message( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling messages. diff --git a/pyrogram/methods/decorators/on_poll.py b/pyrogram/methods/decorators/on_poll.py index cf5edd4a..26940403 100644 --- a/pyrogram/methods/decorators/on_poll.py +++ b/pyrogram/methods/decorators/on_poll.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnPoll(Scaffold): def on_poll( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling poll updates. diff --git a/pyrogram/methods/decorators/on_raw_update.py b/pyrogram/methods/decorators/on_raw_update.py index 04bf35d9..f61b156b 100644 --- a/pyrogram/methods/decorators/on_raw_update.py +++ b/pyrogram/methods/decorators/on_raw_update.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class OnRawUpdate(Scaffold): def on_raw_update( - self=None, - group: int = 0 + self=None, + group: int = 0 ) -> callable: """Decorator for handling raw updates. diff --git a/pyrogram/methods/decorators/on_user_status.py b/pyrogram/methods/decorators/on_user_status.py index b3b63aec..38760c2f 100644 --- a/pyrogram/methods/decorators/on_user_status.py +++ b/pyrogram/methods/decorators/on_user_status.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class OnUserStatus(Scaffold): def on_user_status( - self=None, - filters=None, - group: int = 0 + self=None, + filters=None, + group: int = 0 ) -> callable: """Decorator for handling user status updates. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the diff --git a/pyrogram/methods/invite_links/approve_chat_join_request.py b/pyrogram/methods/invite_links/approve_chat_join_request.py index 0d227db7..0bb2f604 100644 --- a/pyrogram/methods/invite_links/approve_chat_join_request.py +++ b/pyrogram/methods/invite_links/approve_chat_join_request.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class ApproveChatJoinRequest(Scaffold): async def approve_chat_join_request( - self, - chat_id: Union[int, str], - user_id: int, + self, + chat_id: Union[int, str], + user_id: int, ) -> bool: """Approve a chat join request. diff --git a/pyrogram/methods/invite_links/create_chat_invite_link.py b/pyrogram/methods/invite_links/create_chat_invite_link.py index e191338c..4e6aded0 100644 --- a/pyrogram/methods/invite_links/create_chat_invite_link.py +++ b/pyrogram/methods/invite_links/create_chat_invite_link.py @@ -25,12 +25,12 @@ from pyrogram.scaffold import Scaffold class CreateChatInviteLink(Scaffold): async def create_chat_invite_link( - self, - chat_id: Union[int, str], - name: str = None, - expire_date: int = None, - member_limit: int = None, - creates_join_request: bool = None + self, + chat_id: Union[int, str], + name: str = None, + expire_date: int = None, + member_limit: int = None, + creates_join_request: bool = None ) -> "types.ChatInviteLink": """Create an additional invite link for a chat. diff --git a/pyrogram/methods/invite_links/decline_chat_join_request.py b/pyrogram/methods/invite_links/decline_chat_join_request.py index 9090de82..3fc01e26 100644 --- a/pyrogram/methods/invite_links/decline_chat_join_request.py +++ b/pyrogram/methods/invite_links/decline_chat_join_request.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class DeclineChatJoinRequest(Scaffold): async def decline_chat_join_request( - self, - chat_id: Union[int, str], - user_id: int, + self, + chat_id: Union[int, str], + user_id: int, ) -> bool: """Decline a chat join request. diff --git a/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py b/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py index 0dd351c6..fda2aadb 100644 --- a/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py +++ b/pyrogram/methods/invite_links/delete_chat_admin_invite_links.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class DeleteChatAdminInviteLinks(Scaffold): async def delete_chat_admin_invite_links( - self, - chat_id: Union[int, str], - admin_id: Union[int, str], + self, + chat_id: Union[int, str], + admin_id: Union[int, str], ) -> bool: """Delete all revoked invite links of an administrator. diff --git a/pyrogram/methods/invite_links/delete_chat_invite_link.py b/pyrogram/methods/invite_links/delete_chat_invite_link.py index 9c331371..eeab4e35 100644 --- a/pyrogram/methods/invite_links/delete_chat_invite_link.py +++ b/pyrogram/methods/invite_links/delete_chat_invite_link.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class DeleteChatInviteLink(Scaffold): async def delete_chat_invite_link( - self, - chat_id: Union[int, str], - invite_link: str, + self, + chat_id: Union[int, str], + invite_link: str, ) -> bool: """Delete an already revoked invite link. diff --git a/pyrogram/methods/invite_links/edit_chat_invite_link.py b/pyrogram/methods/invite_links/edit_chat_invite_link.py index d91c43f9..5c9dc9ff 100644 --- a/pyrogram/methods/invite_links/edit_chat_invite_link.py +++ b/pyrogram/methods/invite_links/edit_chat_invite_link.py @@ -25,13 +25,13 @@ from pyrogram.scaffold import Scaffold class EditChatInviteLink(Scaffold): async def edit_chat_invite_link( - self, - chat_id: Union[int, str], - invite_link: str, - name: str = None, - expire_date: int = None, - member_limit: int = None, - creates_join_request: bool = None + self, + chat_id: Union[int, str], + invite_link: str, + name: str = None, + expire_date: int = None, + member_limit: int = None, + creates_join_request: bool = None ) -> "types.ChatInviteLink": """Edit a non-primary invite link. diff --git a/pyrogram/methods/invite_links/export_chat_invite_link.py b/pyrogram/methods/invite_links/export_chat_invite_link.py index 739d6caa..061ccdf3 100644 --- a/pyrogram/methods/invite_links/export_chat_invite_link.py +++ b/pyrogram/methods/invite_links/export_chat_invite_link.py @@ -25,8 +25,8 @@ from pyrogram.scaffold import Scaffold class ExportChatInviteLink(Scaffold): async def export_chat_invite_link( - self, - chat_id: Union[int, str], + self, + chat_id: Union[int, str], ) -> "types.ChatInviteLink": """Generate a new primary invite link for a chat; any previously generated primary link is revoked. diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py index 01c04f05..8687795d 100644 --- a/pyrogram/methods/invite_links/get_chat_admin_invite_links.py +++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py @@ -25,11 +25,11 @@ from pyrogram.scaffold import Scaffold class GetChatAdminInviteLinks(Scaffold): async def get_chat_admin_invite_links( - self, - chat_id: Union[int, str], - admin_id: Union[int, str], - revoked: bool = False, - limit: int = 0, + self, + chat_id: Union[int, str], + admin_id: Union[int, str], + revoked: bool = False, + limit: int = 0, ) -> Optional[AsyncGenerator["types.ChatInviteLink", None]]: """Get the invite links created by an administrator in a chat. diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py index 45b35720..789f551a 100644 --- a/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py +++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class GetChatAdminInviteLinksCount(Scaffold): async def get_chat_admin_invite_links_count( - self, - chat_id: Union[int, str], - admin_id: Union[int, str], - revoked: bool = False, + self, + chat_id: Union[int, str], + admin_id: Union[int, str], + revoked: bool = False, ) -> int: """Get the count of the invite links created by an administrator in a chat. diff --git a/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py b/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py index c6c6f202..8b048a58 100644 --- a/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py +++ b/pyrogram/methods/invite_links/get_chat_admins_with_invite_links.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class GetChatAdminsWithInviteLinks(Scaffold): async def get_chat_admins_with_invite_links( - self, - chat_id: Union[int, str], + self, + chat_id: Union[int, str], ): """Get the list of the administrators that have exported invite links in a chat. diff --git a/pyrogram/methods/invite_links/get_chat_invite_link.py b/pyrogram/methods/invite_links/get_chat_invite_link.py index 7146e325..a5361bab 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class GetChatInviteLink(Scaffold): async def get_chat_invite_link( - self, - chat_id: Union[int, str], - invite_link: str, + self, + chat_id: Union[int, str], + invite_link: str, ) -> "types.ChatInviteLink": """Get detailed information about a chat invite link. diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_members.py b/pyrogram/methods/invite_links/get_chat_invite_link_members.py index 63bb2adb..5d6e9208 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link_members.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link_members.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class GetChatInviteLinkMembers(Scaffold): async def get_chat_invite_link_members( - self, - chat_id: Union[int, str], - invite_link: str, - limit: int = 0 + self, + chat_id: Union[int, str], + invite_link: str, + limit: int = 0 ) -> Optional[AsyncGenerator["types.ChatMember", None]]: """Get the members who joined the chat with the invite link. diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_members_count.py b/pyrogram/methods/invite_links/get_chat_invite_link_members_count.py index 6ea712b4..a4f5bbb7 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link_members_count.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link_members_count.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class GetChatInviteLinkMembersCount(Scaffold): async def get_chat_invite_link_members_count( - self, - chat_id: Union[int, str], - invite_link: str + self, + chat_id: Union[int, str], + invite_link: str ) -> int: """Get the count of the members who joined the chat with the invite link. diff --git a/pyrogram/methods/invite_links/revoke_chat_invite_link.py b/pyrogram/methods/invite_links/revoke_chat_invite_link.py index df05eba3..cb3c39cd 100644 --- a/pyrogram/methods/invite_links/revoke_chat_invite_link.py +++ b/pyrogram/methods/invite_links/revoke_chat_invite_link.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class RevokeChatInviteLink(Scaffold): async def revoke_chat_invite_link( - self, - chat_id: Union[int, str], - invite_link: str, + self, + chat_id: Union[int, str], + invite_link: str, ) -> "types.ChatInviteLink": """Revoke a previously created invite link. diff --git a/pyrogram/methods/messages/copy_media_group.py b/pyrogram/methods/messages/copy_media_group.py index f1f398c1..72d8d04b 100644 --- a/pyrogram/methods/messages/copy_media_group.py +++ b/pyrogram/methods/messages/copy_media_group.py @@ -24,14 +24,14 @@ from pyrogram.scaffold import Scaffold class CopyMediaGroup(Scaffold): async def copy_media_group( - self, - chat_id: Union[int, str], - from_chat_id: Union[int, str], - message_id: int, - captions: Union[List[str], str] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, + self, + chat_id: Union[int, str], + from_chat_id: Union[int, str], + message_id: int, + captions: Union[List[str], str] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, ) -> List["types.Message"]: """Copy a media group by providing one of the message ids. diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py index a559ff24..1295edef 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -27,23 +27,23 @@ log = logging.getLogger(__name__) class CopyMessage(Scaffold): async def copy_message( - self, - chat_id: Union[int, str], - from_chat_id: Union[int, str], - message_id: int, - caption: str = None, - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + from_chat_id: Union[int, str], + message_id: int, + caption: str = None, + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> List["types.Message"]: """Copy messages of any kind. diff --git a/pyrogram/methods/messages/delete_messages.py b/pyrogram/methods/messages/delete_messages.py index 4df5eb32..b9807dc5 100644 --- a/pyrogram/methods/messages/delete_messages.py +++ b/pyrogram/methods/messages/delete_messages.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class DeleteMessages(Scaffold): async def delete_messages( - self, - chat_id: Union[int, str], - message_ids: Union[int, Iterable[int]], - revoke: bool = True + self, + chat_id: Union[int, str], + message_ids: Union[int, Iterable[int]], + revoke: bool = True ) -> bool: """Delete messages, including service messages. diff --git a/pyrogram/methods/messages/download_media.py b/pyrogram/methods/messages/download_media.py index e800ef38..c1472e95 100644 --- a/pyrogram/methods/messages/download_media.py +++ b/pyrogram/methods/messages/download_media.py @@ -31,12 +31,12 @@ DEFAULT_DOWNLOAD_DIR = "downloads/" class DownloadMedia(Scaffold): async def download_media( - self, - message: Union["types.Message", str], - file_name: str = DEFAULT_DOWNLOAD_DIR, - block: bool = True, - progress: callable = None, - progress_args: tuple = () + self, + message: Union["types.Message", str], + file_name: str = DEFAULT_DOWNLOAD_DIR, + block: bool = True, + progress: callable = None, + progress_args: tuple = () ) -> Optional[str]: """Download the media from a message. diff --git a/pyrogram/methods/messages/edit_inline_caption.py b/pyrogram/methods/messages/edit_inline_caption.py index bb7d4364..2f009a05 100644 --- a/pyrogram/methods/messages/edit_inline_caption.py +++ b/pyrogram/methods/messages/edit_inline_caption.py @@ -24,11 +24,11 @@ from pyrogram.scaffold import Scaffold class EditInlineCaption(Scaffold): async def edit_inline_caption( - self, - inline_message_id: str, - caption: str, - parse_mode: Optional[str] = object, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + inline_message_id: str, + caption: str, + parse_mode: Optional[str] = object, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> bool: """Edit the caption of inline media messages. diff --git a/pyrogram/methods/messages/edit_inline_media.py b/pyrogram/methods/messages/edit_inline_media.py index fbb3ff9b..6b8c834a 100644 --- a/pyrogram/methods/messages/edit_inline_media.py +++ b/pyrogram/methods/messages/edit_inline_media.py @@ -29,10 +29,10 @@ from .inline_session import get_session class EditInlineMedia(Scaffold): async def edit_inline_media( - self, - inline_message_id: str, - media: "types.InputMedia", - reply_markup: "types.InlineKeyboardMarkup" = None + self, + inline_message_id: str, + media: "types.InputMedia", + reply_markup: "types.InlineKeyboardMarkup" = None ) -> bool: """Edit inline animation, audio, document, photo or video messages. diff --git a/pyrogram/methods/messages/edit_inline_reply_markup.py b/pyrogram/methods/messages/edit_inline_reply_markup.py index 7f942eee..614da617 100644 --- a/pyrogram/methods/messages/edit_inline_reply_markup.py +++ b/pyrogram/methods/messages/edit_inline_reply_markup.py @@ -25,9 +25,9 @@ from .inline_session import get_session class EditInlineReplyMarkup(Scaffold): async def edit_inline_reply_markup( - self, - inline_message_id: str, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + inline_message_id: str, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> bool: """Edit only the reply markup of inline messages sent via the bot (for inline bots). diff --git a/pyrogram/methods/messages/edit_inline_text.py b/pyrogram/methods/messages/edit_inline_text.py index 65e66ee1..996dd4f5 100644 --- a/pyrogram/methods/messages/edit_inline_text.py +++ b/pyrogram/methods/messages/edit_inline_text.py @@ -27,12 +27,12 @@ from .inline_session import get_session class EditInlineText(Scaffold): async def edit_inline_text( - self, - inline_message_id: str, - text: str, - parse_mode: Optional[str] = object, - disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + inline_message_id: str, + text: str, + parse_mode: Optional[str] = object, + disable_web_page_preview: bool = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> bool: """Edit the text of inline messages. diff --git a/pyrogram/methods/messages/edit_message_caption.py b/pyrogram/methods/messages/edit_message_caption.py index 36a95f1b..9abdfbe9 100644 --- a/pyrogram/methods/messages/edit_message_caption.py +++ b/pyrogram/methods/messages/edit_message_caption.py @@ -24,13 +24,13 @@ from pyrogram.scaffold import Scaffold class EditMessageCaption(Scaffold): async def edit_message_caption( - self, - chat_id: Union[int, str], - message_id: int, - caption: str, - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + chat_id: Union[int, str], + message_id: int, + caption: str, + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "types.Message": """Edit the caption of media messages. diff --git a/pyrogram/methods/messages/edit_message_media.py b/pyrogram/methods/messages/edit_message_media.py index 7be03adc..4e443e71 100644 --- a/pyrogram/methods/messages/edit_message_media.py +++ b/pyrogram/methods/messages/edit_message_media.py @@ -29,12 +29,12 @@ from pyrogram.scaffold import Scaffold class EditMessageMedia(Scaffold): async def edit_message_media( - self, - chat_id: Union[int, str], - message_id: int, - media: "types.InputMedia", - reply_markup: "types.InlineKeyboardMarkup" = None, - file_name: str = None + self, + chat_id: Union[int, str], + message_id: int, + media: "types.InputMedia", + reply_markup: "types.InlineKeyboardMarkup" = None, + file_name: str = None ) -> "types.Message": """Edit animation, audio, document, photo or video messages. diff --git a/pyrogram/methods/messages/edit_message_reply_markup.py b/pyrogram/methods/messages/edit_message_reply_markup.py index b5b50b3a..2bbe1bc9 100644 --- a/pyrogram/methods/messages/edit_message_reply_markup.py +++ b/pyrogram/methods/messages/edit_message_reply_markup.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class EditMessageReplyMarkup(Scaffold): async def edit_message_reply_markup( - self, - chat_id: Union[int, str], - message_id: int, - reply_markup: "types.InlineKeyboardMarkup" = None, + self, + chat_id: Union[int, str], + message_id: int, + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> "types.Message": """Edit only the reply markup of messages sent by the bot. diff --git a/pyrogram/methods/messages/edit_message_text.py b/pyrogram/methods/messages/edit_message_text.py index 499bf06d..5d6ba9cf 100644 --- a/pyrogram/methods/messages/edit_message_text.py +++ b/pyrogram/methods/messages/edit_message_text.py @@ -26,14 +26,14 @@ from pyrogram.scaffold import Scaffold class EditMessageText(Scaffold): async def edit_message_text( - self, - chat_id: Union[int, str], - message_id: int, - text: str, - parse_mode: Optional[str] = object, - entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + chat_id: Union[int, str], + message_id: int, + text: str, + parse_mode: Optional[str] = object, + entities: List["types.MessageEntity"] = None, + disable_web_page_preview: bool = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "types.Message": """Edit the text of messages. diff --git a/pyrogram/methods/messages/forward_messages.py b/pyrogram/methods/messages/forward_messages.py index d8fd43a9..caa627d8 100644 --- a/pyrogram/methods/messages/forward_messages.py +++ b/pyrogram/methods/messages/forward_messages.py @@ -25,13 +25,13 @@ from pyrogram.scaffold import Scaffold class ForwardMessages(Scaffold): async def forward_messages( - self, - chat_id: Union[int, str], - from_chat_id: Union[int, str], - message_ids: Union[int, Iterable[int]], - disable_notification: bool = None, - schedule_date: int = None, - protect_content: bool = None + self, + chat_id: Union[int, str], + from_chat_id: Union[int, str], + message_ids: Union[int, Iterable[int]], + disable_notification: bool = None, + schedule_date: int = None, + protect_content: bool = None ) -> Union["types.Message", List["types.Message"]]: """Forward messages of any kind. diff --git a/pyrogram/methods/messages/get_discussion_message.py b/pyrogram/methods/messages/get_discussion_message.py index 3773e6b6..c7d47261 100644 --- a/pyrogram/methods/messages/get_discussion_message.py +++ b/pyrogram/methods/messages/get_discussion_message.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class GetDiscussionMessage(Scaffold): async def get_discussion_message( - self, - chat_id: Union[int, str], - message_id: int, + self, + chat_id: Union[int, str], + message_id: int, ) -> "types.Message": """Get the discussion message from the linked discussion group of a channel post. diff --git a/pyrogram/methods/messages/get_history.py b/pyrogram/methods/messages/get_history.py index 6d2561cb..d80a6b8b 100644 --- a/pyrogram/methods/messages/get_history.py +++ b/pyrogram/methods/messages/get_history.py @@ -29,13 +29,13 @@ log = logging.getLogger(__name__) class GetHistory(Scaffold): async def get_history( - self, - chat_id: Union[int, str], - limit: int = 100, - offset: int = 0, - offset_id: int = 0, - offset_date: int = 0, - reverse: bool = False + self, + chat_id: Union[int, str], + limit: int = 100, + offset: int = 0, + offset_id: int = 0, + offset_date: int = 0, + reverse: bool = False ) -> List["types.Message"]: """Retrieve a chunk of the history of a chat. diff --git a/pyrogram/methods/messages/get_history_count.py b/pyrogram/methods/messages/get_history_count.py index be0a791d..9facdbeb 100644 --- a/pyrogram/methods/messages/get_history_count.py +++ b/pyrogram/methods/messages/get_history_count.py @@ -27,8 +27,8 @@ log = logging.getLogger(__name__) class GetHistoryCount(Scaffold): async def get_history_count( - self, - chat_id: Union[int, str] + self, + chat_id: Union[int, str] ) -> int: """Get the total count of messages in a chat. diff --git a/pyrogram/methods/messages/get_media_group.py b/pyrogram/methods/messages/get_media_group.py index 55beba12..3b33bfd4 100644 --- a/pyrogram/methods/messages/get_media_group.py +++ b/pyrogram/methods/messages/get_media_group.py @@ -27,9 +27,9 @@ log = logging.getLogger(__name__) class GetMediaGroup(Scaffold): async def get_media_group( - self, - chat_id: Union[int, str], - message_id: int + self, + chat_id: Union[int, str], + message_id: int ) -> List["types.Message"]: """Get the media group a message belongs to. diff --git a/pyrogram/methods/messages/get_messages.py b/pyrogram/methods/messages/get_messages.py index 5c0f042d..b9c0fbf7 100644 --- a/pyrogram/methods/messages/get_messages.py +++ b/pyrogram/methods/messages/get_messages.py @@ -32,11 +32,11 @@ log = logging.getLogger(__name__) class GetMessages(Scaffold): async def get_messages( - self, - chat_id: Union[int, str], - message_ids: Union[int, Iterable[int]] = None, - reply_to_message_ids: Union[int, Iterable[int]] = None, - replies: int = 1 + self, + chat_id: Union[int, str], + message_ids: Union[int, Iterable[int]] = None, + reply_to_message_ids: Union[int, Iterable[int]] = None, + replies: int = 1 ) -> Union["types.Message", List["types.Message"]]: """Get one or more messages from a chat by using message identifiers. diff --git a/pyrogram/methods/messages/iter_history.py b/pyrogram/methods/messages/iter_history.py index da8a4d1c..2e60dfde 100644 --- a/pyrogram/methods/messages/iter_history.py +++ b/pyrogram/methods/messages/iter_history.py @@ -24,13 +24,13 @@ from pyrogram.scaffold import Scaffold class IterHistory(Scaffold): async def iter_history( - self, - chat_id: Union[int, str], - limit: int = 0, - offset: int = 0, - offset_id: int = 0, - offset_date: int = 0, - reverse: bool = False + self, + chat_id: Union[int, str], + limit: int = 0, + offset: int = 0, + offset_id: int = 0, + offset_date: int = 0, + reverse: bool = False ) -> Optional[AsyncGenerator["types.Message", None]]: """Iterate through a chat history sequentially. diff --git a/pyrogram/methods/messages/read_history.py b/pyrogram/methods/messages/read_history.py index f83100bc..881b59ad 100644 --- a/pyrogram/methods/messages/read_history.py +++ b/pyrogram/methods/messages/read_history.py @@ -24,9 +24,9 @@ from pyrogram.scaffold import Scaffold class ReadHistory(Scaffold): async def read_history( - self, - chat_id: Union[int, str], - max_id: int = 0 + self, + chat_id: Union[int, str], + max_id: int = 0 ) -> bool: """Mark a chat's message history as read. diff --git a/pyrogram/methods/messages/retract_vote.py b/pyrogram/methods/messages/retract_vote.py index ac66df62..4baba811 100644 --- a/pyrogram/methods/messages/retract_vote.py +++ b/pyrogram/methods/messages/retract_vote.py @@ -25,9 +25,9 @@ from pyrogram.scaffold import Scaffold class RetractVote(Scaffold): async def retract_vote( - self, - chat_id: Union[int, str], - message_id: int + self, + chat_id: Union[int, str], + message_id: int ) -> "types.Poll": """Retract your vote in a poll. diff --git a/pyrogram/methods/messages/search_global.py b/pyrogram/methods/messages/search_global.py index 81f3a3a6..c3fb7acb 100644 --- a/pyrogram/methods/messages/search_global.py +++ b/pyrogram/methods/messages/search_global.py @@ -46,10 +46,10 @@ POSSIBLE_VALUES = list(map(lambda x: x.lower(), filter(lambda x: not x.startswit class SearchGlobal(Scaffold): async def search_global( - self, - query: str = "", - filter: str = "empty", - limit: int = 0, + self, + query: str = "", + filter: str = "empty", + limit: int = 0, ) -> Optional[AsyncGenerator["types.Message", None]]: """Search messages globally from all of your chats. diff --git a/pyrogram/methods/messages/search_global_count.py b/pyrogram/methods/messages/search_global_count.py index 92c51481..78b69654 100644 --- a/pyrogram/methods/messages/search_global_count.py +++ b/pyrogram/methods/messages/search_global_count.py @@ -23,9 +23,9 @@ from .search_messages import Filters, POSSIBLE_VALUES class SearchGlobalCount(Scaffold): async def search_global_count( - self, - query: str = "", - filter: str = "empty", + self, + query: str = "", + filter: str = "empty", ) -> int: """Get the count of messages resulting from a global search. diff --git a/pyrogram/methods/messages/search_messages.py b/pyrogram/methods/messages/search_messages.py index cdaa0168..91bd6a5a 100644 --- a/pyrogram/methods/messages/search_messages.py +++ b/pyrogram/methods/messages/search_messages.py @@ -49,13 +49,13 @@ POSSIBLE_VALUES = list(map(lambda x: x.lower(), filter(lambda x: not x.startswit # noinspection PyShadowingBuiltins async def get_chunk( - client: Scaffold, - chat_id: Union[int, str], - query: str = "", - filter: str = "empty", - offset: int = 0, - limit: int = 100, - from_user: Union[int, str] = None + client: Scaffold, + chat_id: Union[int, str], + query: str = "", + filter: str = "empty", + offset: int = 0, + limit: int = 100, + from_user: Union[int, str] = None ) -> List["types.Message"]: try: filter = Filters.__dict__[filter.upper()] @@ -91,13 +91,13 @@ async def get_chunk( class SearchMessages(Scaffold): # noinspection PyShadowingBuiltins async def search_messages( - self, - chat_id: Union[int, str], - query: str = "", - offset: int = 0, - filter: str = "empty", - limit: int = 0, - from_user: Union[int, str] = None + self, + chat_id: Union[int, str], + query: str = "", + offset: int = 0, + filter: str = "empty", + limit: int = 0, + from_user: Union[int, str] = None ) -> Optional[AsyncGenerator["types.Message", None]]: """Search for text and media messages inside a specific chat. diff --git a/pyrogram/methods/messages/search_messages_count.py b/pyrogram/methods/messages/search_messages_count.py index 49f6f532..3004eb39 100644 --- a/pyrogram/methods/messages/search_messages_count.py +++ b/pyrogram/methods/messages/search_messages_count.py @@ -25,11 +25,11 @@ from .search_messages import Filters, POSSIBLE_VALUES class SearchMessagesCount(Scaffold): async def search_messages_count( - self, - chat_id: Union[int, str], - query: str = "", - filter: str = "empty", - from_user: Union[int, str] = None + self, + chat_id: Union[int, str], + query: str = "", + filter: str = "empty", + from_user: Union[int, str] = None ) -> int: """Get the count of messages resulting from a search inside a chat. diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index f4a16653..01856a79 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -31,30 +31,30 @@ from pyrogram.scaffold import Scaffold class SendAnimation(Scaffold): async def send_animation( - self, - chat_id: Union[int, str], - animation: Union[str, BinaryIO], - caption: str = "", - unsave: bool = False, - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - width: int = 0, - height: int = 0, - thumb: Union[str, BinaryIO] = None, - file_name: str = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + animation: Union[str, BinaryIO], + caption: str = "", + unsave: bool = False, + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + width: int = 0, + height: int = 0, + thumb: Union[str, BinaryIO] = None, + file_name: str = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send animation files (animation or H.264/MPEG-4 AVC video without sound). diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 45eba40b..4ce02c31 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -31,29 +31,29 @@ from pyrogram.scaffold import Scaffold class SendAudio(Scaffold): async def send_audio( - self, - chat_id: Union[int, str], - audio: Union[str, BinaryIO], - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - performer: str = None, - title: str = None, - thumb: Union[str, BinaryIO] = None, - file_name: str = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + audio: Union[str, BinaryIO], + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + performer: str = None, + title: str = None, + thumb: Union[str, BinaryIO] = None, + file_name: str = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send audio files. diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index c5405644..84fe9b17 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -26,22 +26,22 @@ from pyrogram.scaffold import Scaffold class SendCachedMedia(Scaffold): async def send_cached_media( - self, - chat_id: Union[int, str], - file_id: str, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + file_id: str, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> Optional["types.Message"]: """Send any media stored on the Telegram servers using a file_id. diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index 8e67778a..f3965777 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -25,22 +25,22 @@ from pyrogram.scaffold import Scaffold class SendContact(Scaffold): async def send_contact( - self, - chat_id: Union[int, str], - phone_number: str, - first_name: str, - last_name: str = None, - vcard: str = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + phone_number: str, + first_name: str, + last_name: str = None, + vcard: str = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send phone contacts. diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index 291f7382..dfc9d5b8 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -25,19 +25,19 @@ from pyrogram.scaffold import Scaffold class SendDice(Scaffold): async def send_dice( - self, - chat_id: Union[int, str], - emoji: str = "🎲", - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + emoji: str = "🎲", + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> Optional["types.Message"]: """Send a dice with a random value from 1 to 6. diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index 01b4cee9..bc407fe2 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -31,27 +31,27 @@ from pyrogram.scaffold import Scaffold class SendDocument(Scaffold): async def send_document( - self, - chat_id: Union[int, str], - document: Union[str, BinaryIO], - thumb: Union[str, BinaryIO] = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - file_name: str = None, - force_document: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + document: Union[str, BinaryIO], + thumb: Union[str, BinaryIO] = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + file_name: str = None, + force_document: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send generic files. diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index 057f8235..d2b6616d 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -25,20 +25,20 @@ from pyrogram.scaffold import Scaffold class SendLocation(Scaffold): async def send_location( - self, - chat_id: Union[int, str], - latitude: float, - longitude: float, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + latitude: float, + longitude: float, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send points on the map. diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 45cdcef8..13d4d62a 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -33,18 +33,18 @@ log = logging.getLogger(__name__) class SendMediaGroup(Scaffold): # TODO: Add progress parameter async def send_media_group( - self, - chat_id: Union[int, str], - media: List[Union[ - "types.InputMediaPhoto", - "types.InputMediaVideo", - "types.InputMediaAudio", - "types.InputMediaDocument" - ]], - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, + self, + chat_id: Union[int, str], + media: List[Union[ + "types.InputMediaPhoto", + "types.InputMediaVideo", + "types.InputMediaAudio", + "types.InputMediaDocument" + ]], + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, ) -> List["types.Message"]: """Send a group of photos or videos as an album. diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index 33287349..c0653a38 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -25,22 +25,22 @@ from pyrogram.scaffold import Scaffold class SendMessage(Scaffold): async def send_message( - self, - chat_id: Union[int, str], - text: str, - parse_mode: Optional[str] = object, - entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + text: str, + parse_mode: Optional[str] = object, + entities: List["types.MessageEntity"] = None, + disable_web_page_preview: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send text messages. diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index 387b5b52..c70be84e 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -31,25 +31,25 @@ from pyrogram.scaffold import Scaffold class SendPhoto(Scaffold): async def send_photo( - self, - chat_id: Union[int, str], - photo: Union[str, BinaryIO], - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - ttl_seconds: int = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + photo: Union[str, BinaryIO], + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + ttl_seconds: int = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send photos. diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py index 43c2d63d..a412bcdf 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -25,24 +25,24 @@ from pyrogram.scaffold import Scaffold class SendPoll(Scaffold): async def send_poll( - self, - chat_id: Union[int, str], - question: str, - options: List[str], - is_anonymous: bool = True, - allows_multiple_answers: bool = None, - type: str = "regular", - correct_option_id: int = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + question: str, + options: List[str], + is_anonymous: bool = True, + allows_multiple_answers: bool = None, + type: str = "regular", + correct_option_id: int = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send a new poll. diff --git a/pyrogram/methods/messages/send_reaction.py b/pyrogram/methods/messages/send_reaction.py index 6d8577ba..9e6c353c 100644 --- a/pyrogram/methods/messages/send_reaction.py +++ b/pyrogram/methods/messages/send_reaction.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class SendReaction(Scaffold): async def send_reaction( - self, - chat_id: Union[int, str], - message_id: int, - emoji: str = "" + self, + chat_id: Union[int, str], + message_id: int, + emoji: str = "" ) -> bool: """Send a reaction to a message. diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index b00192eb..641cc635 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -31,21 +31,21 @@ from pyrogram.scaffold import Scaffold class SendSticker(Scaffold): async def send_sticker( - self, - chat_id: Union[int, str], - sticker: Union[str, BinaryIO], - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + sticker: Union[str, BinaryIO], + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send static .webp or animated .tgs stickers. diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py index 21109460..7941485e 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -25,24 +25,24 @@ from pyrogram.scaffold import Scaffold class SendVenue(Scaffold): async def send_venue( - self, - chat_id: Union[int, str], - latitude: float, - longitude: float, - title: str, - address: str, - foursquare_id: str = "", - foursquare_type: str = "", - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + chat_id: Union[int, str], + latitude: float, + longitude: float, + title: str, + address: str, + foursquare_id: str = "", + foursquare_type: str = "", + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "types.Message": """Send information about a venue. diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 38c3d857..cccc07ab 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -31,31 +31,31 @@ from pyrogram.scaffold import Scaffold class SendVideo(Scaffold): async def send_video( - self, - chat_id: Union[int, str], - video: Union[str, BinaryIO], - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - ttl_seconds: int = None, - duration: int = 0, - width: int = 0, - height: int = 0, - thumb: Union[str, BinaryIO] = None, - file_name: str = None, - supports_streaming: bool = True, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + video: Union[str, BinaryIO], + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + ttl_seconds: int = None, + duration: int = 0, + width: int = 0, + height: int = 0, + thumb: Union[str, BinaryIO] = None, + file_name: str = None, + supports_streaming: bool = True, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send video files. diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index 6779cbaa..1e52f3ab 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -30,24 +30,24 @@ from pyrogram.scaffold import Scaffold class SendVideoNote(Scaffold): async def send_video_note( - self, - chat_id: Union[int, str], - video_note: Union[str, BinaryIO], - duration: int = 0, - length: int = 1, - thumb: Union[str, BinaryIO] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + video_note: Union[str, BinaryIO], + duration: int = 0, + length: int = 1, + thumb: Union[str, BinaryIO] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send video messages. diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index fd7e5c75..80eb386d 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -31,25 +31,25 @@ from pyrogram.scaffold import Scaffold class SendVoice(Scaffold): async def send_voice( - self, - chat_id: Union[int, str], - voice: Union[str, BinaryIO], - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + chat_id: Union[int, str], + voice: Union[str, BinaryIO], + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> Optional["types.Message"]: """Send audio files. diff --git a/pyrogram/methods/messages/stop_poll.py b/pyrogram/methods/messages/stop_poll.py index f6da7fce..113f1618 100644 --- a/pyrogram/methods/messages/stop_poll.py +++ b/pyrogram/methods/messages/stop_poll.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class StopPoll(Scaffold): async def stop_poll( - self, - chat_id: Union[int, str], - message_id: int, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + chat_id: Union[int, str], + message_id: int, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "types.Poll": """Stop a poll which was sent by you. diff --git a/pyrogram/methods/messages/vote_poll.py b/pyrogram/methods/messages/vote_poll.py index d782e2d5..d6753a27 100644 --- a/pyrogram/methods/messages/vote_poll.py +++ b/pyrogram/methods/messages/vote_poll.py @@ -25,10 +25,10 @@ from pyrogram.scaffold import Scaffold class VotePoll(Scaffold): async def vote_poll( - self, - chat_id: Union[int, str], - message_id: id, - options: Union[int, List[int]] + self, + chat_id: Union[int, str], + message_id: id, + options: Union[int, List[int]] ) -> "types.Poll": """Vote a poll. diff --git a/pyrogram/methods/password/change_cloud_password.py b/pyrogram/methods/password/change_cloud_password.py index df93086b..f950c65a 100644 --- a/pyrogram/methods/password/change_cloud_password.py +++ b/pyrogram/methods/password/change_cloud_password.py @@ -25,10 +25,10 @@ from pyrogram.utils import compute_password_hash, compute_password_check, btoi, class ChangeCloudPassword(Scaffold): async def change_cloud_password( - self, - current_password: str, - new_password: str, - new_hint: str = "" + self, + current_password: str, + new_password: str, + new_hint: str = "" ) -> bool: """Change your Two-Step Verification password (Cloud Password) with a new one. diff --git a/pyrogram/methods/password/enable_cloud_password.py b/pyrogram/methods/password/enable_cloud_password.py index 8b03f442..7073af59 100644 --- a/pyrogram/methods/password/enable_cloud_password.py +++ b/pyrogram/methods/password/enable_cloud_password.py @@ -25,10 +25,10 @@ from pyrogram.utils import compute_password_hash, btoi, itob class EnableCloudPassword(Scaffold): async def enable_cloud_password( - self, - password: str, - hint: str = "", - email: str = None + self, + password: str, + hint: str = "", + email: str = None ) -> bool: """Enable the Two-Step Verification security feature (Cloud Password) on your account. diff --git a/pyrogram/methods/password/remove_cloud_password.py b/pyrogram/methods/password/remove_cloud_password.py index e5a3b879..18ae31e5 100644 --- a/pyrogram/methods/password/remove_cloud_password.py +++ b/pyrogram/methods/password/remove_cloud_password.py @@ -23,8 +23,8 @@ from pyrogram.utils import compute_password_check class RemoveCloudPassword(Scaffold): async def remove_cloud_password( - self, - password: str + self, + password: str ) -> bool: """Turn off the Two-Step Verification security feature (Cloud Password) on your account. diff --git a/pyrogram/methods/users/block_user.py b/pyrogram/methods/users/block_user.py index 46e19800..0efda2b9 100644 --- a/pyrogram/methods/users/block_user.py +++ b/pyrogram/methods/users/block_user.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class BlockUser(Scaffold): async def block_user( - self, - user_id: Union[int, str] + self, + user_id: Union[int, str] ) -> bool: """Block a user. diff --git a/pyrogram/methods/users/delete_profile_photos.py b/pyrogram/methods/users/delete_profile_photos.py index a3d84d2a..64f3ce77 100644 --- a/pyrogram/methods/users/delete_profile_photos.py +++ b/pyrogram/methods/users/delete_profile_photos.py @@ -26,8 +26,8 @@ from pyrogram.scaffold import Scaffold class DeleteProfilePhotos(Scaffold): async def delete_profile_photos( - self, - photo_ids: Union[str, List[str]] + self, + photo_ids: Union[str, List[str]] ) -> bool: """Delete your own profile photos. diff --git a/pyrogram/methods/users/get_profile_photos.py b/pyrogram/methods/users/get_profile_photos.py index e367720c..fb8c75c4 100644 --- a/pyrogram/methods/users/get_profile_photos.py +++ b/pyrogram/methods/users/get_profile_photos.py @@ -26,10 +26,10 @@ from pyrogram.scaffold import Scaffold class GetProfilePhotos(Scaffold): async def get_profile_photos( - self, - chat_id: Union[int, str], - offset: int = 0, - limit: int = 100 + self, + chat_id: Union[int, str], + offset: int = 0, + limit: int = 100 ) -> List["types.Photo"]: """Get a list of profile pictures for a user or a chat. diff --git a/pyrogram/methods/users/get_users.py b/pyrogram/methods/users/get_users.py index ec2f57c3..43ae0084 100644 --- a/pyrogram/methods/users/get_users.py +++ b/pyrogram/methods/users/get_users.py @@ -26,8 +26,8 @@ from pyrogram.scaffold import Scaffold class GetUsers(Scaffold): async def get_users( - self, - user_ids: Union[Iterable[Union[int, str]], int, str] + self, + user_ids: Union[Iterable[Union[int, str]], int, str] ) -> Union["types.User", List["types.User"]]: """Get information about a user. You can retrieve up to 200 users at once. diff --git a/pyrogram/methods/users/iter_profile_photos.py b/pyrogram/methods/users/iter_profile_photos.py index 5a32271e..eda77a88 100644 --- a/pyrogram/methods/users/iter_profile_photos.py +++ b/pyrogram/methods/users/iter_profile_photos.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class IterProfilePhotos(Scaffold): async def iter_profile_photos( - self, - chat_id: Union[int, str], - offset: int = 0, - limit: int = 0, + self, + chat_id: Union[int, str], + offset: int = 0, + limit: int = 0, ) -> Optional[AsyncGenerator["types.Photo", None]]: """Iterate through a chat or a user profile photos sequentially. diff --git a/pyrogram/methods/users/set_profile_photo.py b/pyrogram/methods/users/set_profile_photo.py index 43e3d4a1..9b1c5c04 100644 --- a/pyrogram/methods/users/set_profile_photo.py +++ b/pyrogram/methods/users/set_profile_photo.py @@ -24,10 +24,10 @@ from pyrogram.scaffold import Scaffold class SetProfilePhoto(Scaffold): async def set_profile_photo( - self, - *, - photo: Union[str, BinaryIO] = None, - video: Union[str, BinaryIO] = None + self, + *, + photo: Union[str, BinaryIO] = None, + video: Union[str, BinaryIO] = None ) -> bool: """Set a new profile photo or video (H.264/MPEG-4 AVC video, max 5 seconds). diff --git a/pyrogram/methods/users/unblock_user.py b/pyrogram/methods/users/unblock_user.py index fc80fc5c..4218bb1e 100644 --- a/pyrogram/methods/users/unblock_user.py +++ b/pyrogram/methods/users/unblock_user.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class UnblockUser(Scaffold): async def unblock_user( - self, - user_id: Union[int, str] + self, + user_id: Union[int, str] ) -> bool: """Unblock a user. diff --git a/pyrogram/methods/users/update_profile.py b/pyrogram/methods/users/update_profile.py index f86e5370..4dc81204 100644 --- a/pyrogram/methods/users/update_profile.py +++ b/pyrogram/methods/users/update_profile.py @@ -22,10 +22,10 @@ from pyrogram.scaffold import Scaffold class UpdateProfile(Scaffold): async def update_profile( - self, - first_name: str = None, - last_name: str = None, - bio: str = None + self, + first_name: str = None, + last_name: str = None, + bio: str = None ) -> bool: """Update your profile details such as first name, last name and bio. diff --git a/pyrogram/methods/users/update_username.py b/pyrogram/methods/users/update_username.py index 3687224b..ce61402a 100644 --- a/pyrogram/methods/users/update_username.py +++ b/pyrogram/methods/users/update_username.py @@ -24,8 +24,8 @@ from pyrogram.scaffold import Scaffold class UpdateUsername(Scaffold): async def update_username( - self, - username: Optional[str] + self, + username: Optional[str] ) -> bool: """Update your own username. diff --git a/pyrogram/raw/core/gzip_packed.py b/pyrogram/raw/core/gzip_packed.py index fe093f31..a2750eab 100644 --- a/pyrogram/raw/core/gzip_packed.py +++ b/pyrogram/raw/core/gzip_packed.py @@ -59,8 +59,3 @@ class GzipPacked(TLObject): ) return b.getvalue() - - def __getattr__(self, item): - if item == "packed_data": - return self.packed_data - return getattr(self.packed_data, item) diff --git a/pyrogram/raw/core/primitives/bytes.py b/pyrogram/raw/core/primitives/bytes.py index be7b4350..eace1feb 100644 --- a/pyrogram/raw/core/primitives/bytes.py +++ b/pyrogram/raw/core/primitives/bytes.py @@ -42,14 +42,14 @@ class Bytes(bytes, TLObject): if length <= 253: return ( - bytes([length]) - + value - + bytes(-(length + 1) % 4) + bytes([length]) + + value + + bytes(-(length + 1) % 4) ) else: return ( - bytes([254]) - + length.to_bytes(3, "little") - + value - + bytes(-length % 4) + bytes([254]) + + length.to_bytes(3, "little") + + value + + bytes(-length % 4) ) diff --git a/pyrogram/raw/core/tl_object.py b/pyrogram/raw/core/tl_object.py index b7b6ba4d..784b24ee 100644 --- a/pyrogram/raw/core/tl_object.py +++ b/pyrogram/raw/core/tl_object.py @@ -33,7 +33,6 @@ class TLObject: function_name = objects.get(int.from_bytes(b.read(4), "little")) if not function_name: return None - print(function_name, type(cast(TLObject, function_name))) return cast(TLObject, function_name).read(b, *args) def write(self, *args: Any) -> bytes: diff --git a/pyrogram/scaffold.py b/pyrogram/scaffold.py index a3bf688c..d68ddf78 100644 --- a/pyrogram/scaffold.py +++ b/pyrogram/scaffold.py @@ -16,14 +16,14 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from asyncio import get_event_loop, set_event_loop, Lock +import asyncio +import os +import platform +import re +import sys from io import StringIO from mimetypes import MimeTypes -from os import cpu_count from pathlib import Path -from platform import python_implementation, python_version, system, release -from re import compile as re_compile -from sys import argv as sys_argv import pyrogram from pyrogram import __version__ @@ -34,15 +34,15 @@ from .mime_types import mime_types class Scaffold: APP_VERSION = f"Pyrogram {__version__}" - DEVICE_MODEL = f"{python_implementation()} {python_version()}" - SYSTEM_VERSION = f"{system()} {release()}" + 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 + 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, cpu_count() + 4) + INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$") + WORKERS = min(32, os.cpu_count() + 4) WORKDIR = PARENT_DIR CONFIG_FILE = PARENT_DIR / "config.ini" @@ -53,11 +53,11 @@ class Scaffold: def __init__(self): try: - get_event_loop() + asyncio.get_event_loop() except RuntimeError: # This happens when creating Client instances inside different threads that don't have an event loop. # Set the main event loop in this thread. - set_event_loop(pyrogram.main_event_loop) + asyncio.set_event_loop(pyrogram.main_event_loop) self.session_name = None self.api_id = None @@ -95,7 +95,7 @@ class Scaffold: self.session = None self.media_sessions = {} - self.media_sessions_lock = Lock() + self.media_sessions_lock = asyncio.Lock() self.is_connected = None self.is_initialized = None diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py index 6c7df9aa..f4f65f21 100644 --- a/pyrogram/session/auth.py +++ b/pyrogram/session/auth.py @@ -51,10 +51,10 @@ class Auth: @staticmethod def pack(data: TLObject) -> bytes: return ( - bytes(8) - + Long(MsgId()) - + Int(len(data.write())) - + data.write() + bytes(8) + + Long(MsgId()) + + Int(len(data.write())) + + data.write() ) @staticmethod @@ -150,13 +150,13 @@ class Auth: new_nonce = new_nonce.to_bytes(32, "little", signed=True) tmp_aes_key = ( - sha1(new_nonce + server_nonce).digest() - + sha1(server_nonce + new_nonce).digest()[:12] + sha1(new_nonce + server_nonce).digest() + + sha1(server_nonce + new_nonce).digest()[:12] ) tmp_aes_iv = ( - sha1(server_nonce + new_nonce).digest()[12:] - + sha1(new_nonce + new_nonce).digest() + new_nonce[:4] + sha1(server_nonce + new_nonce).digest()[12:] + + sha1(new_nonce + new_nonce).digest() + new_nonce[:4] ) server_nonce = int.from_bytes(server_nonce, "little", signed=True) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 23b8ad5d..6eb53e82 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -54,13 +54,13 @@ class Session: PING_INTERVAL = 5 def __init__( - self, - client: "pyrogram.Client", - dc_id: int, - auth_key: bytes, - test_mode: bool, - is_media: bool = False, - is_cdn: bool = False + self, + client: "pyrogram.Client", + dc_id: int, + auth_key: bytes, + test_mode: bool, + is_media: bool = False, + is_cdn: bool = False ): self.client = client self.dc_id = dc_id @@ -387,11 +387,11 @@ class Session: return result async def send( - self, - data: TLObject, - retries: int = MAX_RETRIES, - timeout: float = WAIT_TIMEOUT, - sleep_threshold: float = SLEEP_THRESHOLD + self, + data: TLObject, + retries: int = MAX_RETRIES, + timeout: float = WAIT_TIMEOUT, + sleep_threshold: float = SLEEP_THRESHOLD ): try: await asyncio.wait_for(self.is_connected.wait(), self.WAIT_TIMEOUT) diff --git a/pyrogram/sync.py b/pyrogram/sync.py index 682c43bb..6db937b3 100644 --- a/pyrogram/sync.py +++ b/pyrogram/sync.py @@ -16,8 +16,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from functools import wraps -from inspect import isclass, iscoroutine, isasyncgen, iscoroutinefunction, isasyncgenfunction +import asyncio +import functools +import inspect +import threading from pyrogram import types from pyrogram.methods import Methods @@ -25,49 +27,46 @@ from pyrogram.methods.utilities import idle as idle_module def async_to_sync(obj, name): - from asyncio import new_event_loop, get_event_loop, set_event_loop, wrap_future, run_coroutine_threadsafe - from threading import current_thread, main_thread - function = getattr(obj, name) - main_loop = get_event_loop() + main_loop = asyncio.get_event_loop() async def consume_generator(coroutine): return types.List([i async for i in coroutine]) - @wraps(function) + @functools.wraps(function) def async_to_sync_wrap(*args, **kwargs): coroutine = function(*args, **kwargs) try: - loop = get_event_loop() + loop = asyncio.get_event_loop() except RuntimeError: - loop = new_event_loop() - set_event_loop(loop) + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) - if current_thread() is main_thread(): + if threading.current_thread() is threading.main_thread(): if loop.is_running(): return coroutine else: - if iscoroutine(coroutine): + if inspect.iscoroutine(coroutine): return loop.run_until_complete(coroutine) - if isasyncgen(coroutine): + if inspect.isasyncgen(coroutine): return loop.run_until_complete(consume_generator(coroutine)) else: - if iscoroutine(coroutine): + if inspect.iscoroutine(coroutine): if loop.is_running(): async def coro_wrapper(): - return await wrap_future(run_coroutine_threadsafe(coroutine, main_loop)) + return await asyncio.wrap_future(asyncio.run_coroutine_threadsafe(coroutine, main_loop)) return coro_wrapper() else: - return run_coroutine_threadsafe(coroutine, main_loop).result() + return asyncio.run_coroutine_threadsafe(coroutine, main_loop).result() - if isasyncgen(coroutine): + if inspect.isasyncgen(coroutine): if loop.is_running(): return coroutine else: - return run_coroutine_threadsafe(consume_generator(coroutine), main_loop).result() + return asyncio.run_coroutine_threadsafe(consume_generator(coroutine), main_loop).result() setattr(obj, name, async_to_sync_wrap) @@ -77,7 +76,7 @@ def wrap(source): method = getattr(source, name) if not name.startswith("_"): - if iscoroutinefunction(method) or isasyncgenfunction(method): + if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(method): async_to_sync(source, name) @@ -88,7 +87,7 @@ wrap(Methods) for class_name in dir(types): cls = getattr(types, class_name) - if isclass(cls): + if inspect.isclass(cls): wrap(cls) # Special case for idle, because it's not inside Methods diff --git a/pyrogram/types/authorization/sent_code.py b/pyrogram/types/authorization/sent_code.py index 0cfa56ce..a471445a 100644 --- a/pyrogram/types/authorization/sent_code.py +++ b/pyrogram/types/authorization/sent_code.py @@ -43,11 +43,11 @@ class SentCode(Object): """ def __init__( - self, *, - type: str, - phone_code_hash: str, - next_type: str = None, - timeout: int = None + self, *, + type: str, + phone_code_hash: str, + next_type: str = None, + timeout: int = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/callback_query.py b/pyrogram/types/bots_and_keyboards/callback_query.py index 19a46df5..8cdd424a 100644 --- a/pyrogram/types/bots_and_keyboards/callback_query.py +++ b/pyrogram/types/bots_and_keyboards/callback_query.py @@ -65,17 +65,17 @@ class CallbackQuery(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: str, - from_user: "types.User", - chat_instance: str, - message: "types.Message" = None, - inline_message_id: str = None, - data: Union[str, bytes] = None, - game_short_name: str = None, - matches: List[Match] = None + self, + *, + client: "pyrogram.Client" = None, + id: str, + from_user: "types.User", + chat_instance: str, + message: "types.Message" = None, + inline_message_id: str = None, + data: Union[str, bytes] = None, + game_short_name: str = None, + matches: List[Match] = None ): super().__init__(client) @@ -169,11 +169,11 @@ class CallbackQuery(Object, Update): ) async def edit_message_text( - self, - text: str, - parse_mode: Optional[str] = object, - disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + text: str, + parse_mode: Optional[str] = object, + disable_web_page_preview: bool = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> Union["types.Message", bool]: """Edit the text of messages attached to callback queries. @@ -222,10 +222,10 @@ class CallbackQuery(Object, Update): ) async def edit_message_caption( - self, - caption: str, - parse_mode: Optional[str] = object, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + caption: str, + parse_mode: Optional[str] = object, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> Union["types.Message", bool]: """Edit the caption of media messages attached to callback queries. @@ -255,9 +255,9 @@ class CallbackQuery(Object, Update): return await self.edit_message_text(caption, parse_mode, reply_markup=reply_markup) async def edit_message_media( - self, - media: "types.InputMedia", - reply_markup: "types.InlineKeyboardMarkup" = None + self, + media: "types.InputMedia", + reply_markup: "types.InlineKeyboardMarkup" = None ) -> Union["types.Message", bool]: """Edit animation, audio, document, photo or video messages attached to callback queries. @@ -292,8 +292,8 @@ class CallbackQuery(Object, Update): ) async def edit_message_reply_markup( - self, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> Union["types.Message", bool]: """Edit only the reply markup of messages attached to callback queries. diff --git a/pyrogram/types/bots_and_keyboards/force_reply.py b/pyrogram/types/bots_and_keyboards/force_reply.py index 52f4955d..025176f2 100644 --- a/pyrogram/types/bots_and_keyboards/force_reply.py +++ b/pyrogram/types/bots_and_keyboards/force_reply.py @@ -39,8 +39,8 @@ class ForceReply(Object): """ def __init__( - self, - selective: bool = None + self, + selective: bool = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/game_high_score.py b/pyrogram/types/bots_and_keyboards/game_high_score.py index 94255776..7de78ce9 100644 --- a/pyrogram/types/bots_and_keyboards/game_high_score.py +++ b/pyrogram/types/bots_and_keyboards/game_high_score.py @@ -37,12 +37,12 @@ class GameHighScore(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - user: "types.User", - score: int, - position: int = None + self, + *, + client: "pyrogram.Client" = None, + user: "types.User", + score: int, + position: int = None ): super().__init__(client) diff --git a/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py index 42b14bfd..9779ec39 100644 --- a/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py +++ b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py @@ -66,15 +66,15 @@ class InlineKeyboardButton(Object): """ def __init__( - self, - text: str, - callback_data: Union[str, bytes] = None, - url: str = None, - login_url: "types.LoginUrl" = None, - user_id: int = None, - switch_inline_query: str = None, - switch_inline_query_current_chat: str = None, - callback_game: "types.CallbackGame" = None + self, + text: str, + callback_data: Union[str, bytes] = None, + url: str = None, + login_url: "types.LoginUrl" = None, + user_id: int = None, + switch_inline_query: str = None, + switch_inline_query_current_chat: str = None, + callback_game: "types.CallbackGame" = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button.py b/pyrogram/types/bots_and_keyboards/keyboard_button.py index d6bbffb3..626df749 100644 --- a/pyrogram/types/bots_and_keyboards/keyboard_button.py +++ b/pyrogram/types/bots_and_keyboards/keyboard_button.py @@ -40,10 +40,10 @@ class KeyboardButton(Object): """ def __init__( - self, - text: str, - request_contact: bool = None, - request_location: bool = None + self, + text: str, + request_contact: bool = None, + request_location: bool = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/login_url.py b/pyrogram/types/bots_and_keyboards/login_url.py index 63cda427..a0af5a1a 100644 --- a/pyrogram/types/bots_and_keyboards/login_url.py +++ b/pyrogram/types/bots_and_keyboards/login_url.py @@ -57,12 +57,12 @@ class LoginUrl(Object): """ def __init__( - self, *, - url: str, - forward_text: str = None, - bot_username: str = None, - request_write_access: str = None, - button_id: int = None + self, *, + url: str, + forward_text: str = None, + bot_username: str = None, + request_write_access: str = None, + button_id: int = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py index 1f82514a..b619216a 100644 --- a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py +++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py @@ -50,11 +50,11 @@ class ReplyKeyboardMarkup(Object): """ def __init__( - self, - keyboard: List[List[Union["types.KeyboardButton", str]]], - resize_keyboard: bool = None, - one_time_keyboard: bool = None, - selective: bool = None + self, + keyboard: List[List[Union["types.KeyboardButton", str]]], + resize_keyboard: bool = None, + one_time_keyboard: bool = None, + selective: bool = None ): super().__init__() diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py index 86109305..479efe90 100644 --- a/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py +++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py @@ -39,8 +39,8 @@ class ReplyKeyboardRemove(Object): """ def __init__( - self, - selective: bool = None + self, + selective: bool = None ): super().__init__() diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py index baf5eef3..623d7379 100644 --- a/pyrogram/types/inline_mode/chosen_inline_result.py +++ b/pyrogram/types/inline_mode/chosen_inline_result.py @@ -54,14 +54,14 @@ class ChosenInlineResult(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - result_id: str, - from_user: "types.User", - query: str, - location: "types.Location" = None, - inline_message_id: str = None + self, + *, + client: "pyrogram.Client" = None, + result_id: str, + from_user: "types.User", + query: str, + location: "types.Location" = None, + inline_message_id: str = None ): super().__init__(client) diff --git a/pyrogram/types/inline_mode/inline_query.py b/pyrogram/types/inline_mode/inline_query.py index 44c36aa4..2522b693 100644 --- a/pyrogram/types/inline_mode/inline_query.py +++ b/pyrogram/types/inline_mode/inline_query.py @@ -58,16 +58,16 @@ class InlineQuery(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: str, - from_user: "types.User", - query: str, - offset: str, - chat_type: str, - location: "types.Location" = None, - matches: List[Match] = None + self, + *, + client: "pyrogram.Client" = None, + id: str, + from_user: "types.User", + query: str, + offset: str, + chat_type: str, + location: "types.Location" = None, + matches: List[Match] = None ): super().__init__(client) @@ -110,14 +110,14 @@ class InlineQuery(Object, Update): ) async def answer( - self, - results: List["types.InlineQueryResult"], - cache_time: int = 300, - is_gallery: bool = False, - is_personal: bool = False, - next_offset: str = "", - switch_pm_text: str = "", - switch_pm_parameter: str = "" + self, + results: List["types.InlineQueryResult"], + cache_time: int = 300, + is_gallery: bool = False, + is_personal: bool = False, + next_offset: str = "", + switch_pm_text: str = "", + switch_pm_parameter: str = "" ): """Bound method *answer* of :obj:`~pyrogram.types.InlineQuery`. diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py index fda08920..48d633c1 100644 --- a/pyrogram/types/inline_mode/inline_query_result.py +++ b/pyrogram/types/inline_mode/inline_query_result.py @@ -54,11 +54,11 @@ class InlineQueryResult(Object): """ def __init__( - self, - type: str, - id: str, - input_message_content: "types.InputMessageContent", - reply_markup: "types.InlineKeyboardMarkup" + self, + type: str, + id: str, + input_message_content: "types.InputMessageContent", + reply_markup: "types.InlineKeyboardMarkup" ): super().__init__() diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py index c70d1cf4..2281ae1c 100644 --- a/pyrogram/types/inline_mode/inline_query_result_animation.py +++ b/pyrogram/types/inline_mode/inline_query_result_animation.py @@ -70,17 +70,17 @@ class InlineQueryResultAnimation(InlineQueryResult): """ def __init__( - self, - animation_url: str, - thumb_url: str = None, - id: str = None, - title: str = None, - description: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + self, + animation_url: str, + thumb_url: str = None, + id: str = None, + title: str = None, + description: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + input_message_content: "types.InputMessageContent" = None ): super().__init__("gif", id, input_message_content, reply_markup) diff --git a/pyrogram/types/inline_mode/inline_query_result_article.py b/pyrogram/types/inline_mode/inline_query_result_article.py index b9756d52..73260dd9 100644 --- a/pyrogram/types/inline_mode/inline_query_result_article.py +++ b/pyrogram/types/inline_mode/inline_query_result_article.py @@ -51,14 +51,14 @@ class InlineQueryResultArticle(InlineQueryResult): """ def __init__( - self, - title: str, - input_message_content: "types.InputMessageContent", - id: str = None, - reply_markup: "types.InlineKeyboardMarkup" = None, - url: str = None, - description: str = None, - thumb_url: str = None + self, + title: str, + input_message_content: "types.InputMessageContent", + id: str = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + url: str = None, + description: str = None, + thumb_url: str = None ): super().__init__("article", id, input_message_content, reply_markup) diff --git a/pyrogram/types/inline_mode/inline_query_result_audio.py b/pyrogram/types/inline_mode/inline_query_result_audio.py index 43cef76c..e36ecb11 100644 --- a/pyrogram/types/inline_mode/inline_query_result_audio.py +++ b/pyrogram/types/inline_mode/inline_query_result_audio.py @@ -68,17 +68,17 @@ class InlineQueryResultAudio(InlineQueryResult): """ def __init__( - self, - audio_url: str, - title: str, - id: str = None, - performer: str = "", - audio_duration: int = 0, - caption: str = "", - parse_mode: Union[str, None] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + self, + audio_url: str, + title: str, + id: str = None, + performer: str = "", + audio_duration: int = 0, + caption: str = "", + parse_mode: Union[str, None] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + input_message_content: "types.InputMessageContent" = None ): super().__init__("audio", id, input_message_content, reply_markup) diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py index fb41b08b..679ee429 100644 --- a/pyrogram/types/inline_mode/inline_query_result_photo.py +++ b/pyrogram/types/inline_mode/inline_query_result_photo.py @@ -70,17 +70,17 @@ class InlineQueryResultPhoto(InlineQueryResult): """ def __init__( - self, - photo_url: str, - thumb_url: str = None, - id: str = None, - title: str = None, - description: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + self, + photo_url: str, + thumb_url: str = None, + id: str = None, + title: str = None, + description: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + input_message_content: "types.InputMessageContent" = None ): super().__init__("photo", id, input_message_content, reply_markup) diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py index 12be2cce..cd5d8454 100644 --- a/pyrogram/types/inline_mode/inline_query_result_video.py +++ b/pyrogram/types/inline_mode/inline_query_result_video.py @@ -82,21 +82,21 @@ class InlineQueryResultVideo(InlineQueryResult): """ def __init__( - self, - video_url: str, - thumb_url: str, - title: str, - id: str = None, - mime_type: str = "video/mp4", - video_width: int = 0, - video_height: int = 0, - video_duration: int = 0, - description: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None, - input_message_content: "types.InputMessageContent" = None + self, + video_url: str, + thumb_url: str, + title: str, + id: str = None, + mime_type: str = "video/mp4", + video_width: int = 0, + video_height: int = 0, + video_duration: int = 0, + description: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None, + input_message_content: "types.InputMessageContent" = None ): super().__init__("video", id, input_message_content, reply_markup) diff --git a/pyrogram/types/input_media/input_media.py b/pyrogram/types/input_media/input_media.py index 3ec9f21b..8e2f3a7b 100644 --- a/pyrogram/types/input_media/input_media.py +++ b/pyrogram/types/input_media/input_media.py @@ -35,11 +35,11 @@ class InputMedia(Object): """ def __init__( - self, - media: str, - caption: str = "", - parse_mode: str = None, - caption_entities: List[MessageEntity] = None + self, + media: str, + caption: str = "", + parse_mode: str = None, + caption_entities: List[MessageEntity] = None ): super().__init__() diff --git a/pyrogram/types/input_media/input_media_animation.py b/pyrogram/types/input_media/input_media_animation.py index b3d9ce6a..76c146c5 100644 --- a/pyrogram/types/input_media/input_media_animation.py +++ b/pyrogram/types/input_media/input_media_animation.py @@ -64,15 +64,15 @@ class InputMediaAnimation(InputMedia): """ def __init__( - self, - media: Union[str, BinaryIO], - thumb: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List[MessageEntity] = None, - width: int = 0, - height: int = 0, - duration: int = 0 + self, + media: Union[str, BinaryIO], + thumb: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List[MessageEntity] = None, + width: int = 0, + height: int = 0, + duration: int = 0 ): super().__init__(media, caption, parse_mode, caption_entities) diff --git a/pyrogram/types/input_media/input_media_audio.py b/pyrogram/types/input_media/input_media_audio.py index 7fdcf9a3..4816659d 100644 --- a/pyrogram/types/input_media/input_media_audio.py +++ b/pyrogram/types/input_media/input_media_audio.py @@ -66,15 +66,15 @@ class InputMediaAudio(InputMedia): """ def __init__( - self, - media: Union[str, BinaryIO], - thumb: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List[MessageEntity] = None, - duration: int = 0, - performer: str = "", - title: str = "" + self, + media: Union[str, BinaryIO], + thumb: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List[MessageEntity] = None, + duration: int = 0, + performer: str = "", + title: str = "" ): super().__init__(media, caption, parse_mode, caption_entities) diff --git a/pyrogram/types/input_media/input_media_document.py b/pyrogram/types/input_media/input_media_document.py index 911fe45e..3b3a38fd 100644 --- a/pyrogram/types/input_media/input_media_document.py +++ b/pyrogram/types/input_media/input_media_document.py @@ -55,12 +55,12 @@ class InputMediaDocument(InputMedia): """ def __init__( - self, - media: Union[str, BinaryIO], - thumb: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List[MessageEntity] = None + self, + media: Union[str, BinaryIO], + thumb: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List[MessageEntity] = None ): super().__init__(media, caption, parse_mode, caption_entities) diff --git a/pyrogram/types/input_media/input_media_photo.py b/pyrogram/types/input_media/input_media_photo.py index f7871083..f733a7b0 100644 --- a/pyrogram/types/input_media/input_media_photo.py +++ b/pyrogram/types/input_media/input_media_photo.py @@ -50,10 +50,10 @@ class InputMediaPhoto(InputMedia): """ def __init__( - self, - media: Union[str, BinaryIO], - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List[MessageEntity] = None + self, + media: Union[str, BinaryIO], + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List[MessageEntity] = None ): super().__init__(media, caption, parse_mode, caption_entities) diff --git a/pyrogram/types/input_media/input_media_video.py b/pyrogram/types/input_media/input_media_video.py index 98d62ecf..48c79f41 100644 --- a/pyrogram/types/input_media/input_media_video.py +++ b/pyrogram/types/input_media/input_media_video.py @@ -68,16 +68,16 @@ class InputMediaVideo(InputMedia): """ def __init__( - self, - media: Union[str, BinaryIO], - thumb: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List[MessageEntity] = None, - width: int = 0, - height: int = 0, - duration: int = 0, - supports_streaming: bool = True + self, + media: Union[str, BinaryIO], + thumb: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List[MessageEntity] = None, + width: int = 0, + height: int = 0, + duration: int = 0, + supports_streaming: bool = True ): super().__init__(media, caption, parse_mode, caption_entities) diff --git a/pyrogram/types/input_message_content/input_text_message_content.py b/pyrogram/types/input_message_content/input_text_message_content.py index 8061b81e..ef54c0b2 100644 --- a/pyrogram/types/input_message_content/input_text_message_content.py +++ b/pyrogram/types/input_message_content/input_text_message_content.py @@ -45,11 +45,11 @@ class InputTextMessageContent(InputMessageContent): """ def __init__( - self, - message_text: str, - parse_mode: Optional[str] = object, - entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None + self, + message_text: str, + parse_mode: Optional[str] = object, + entities: List["types.MessageEntity"] = None, + disable_web_page_preview: bool = None ): super().__init__() diff --git a/pyrogram/types/messages_and_media/animation.py b/pyrogram/types/messages_and_media/animation.py index 67e4fe30..ce901734 100644 --- a/pyrogram/types/messages_and_media/animation.py +++ b/pyrogram/types/messages_and_media/animation.py @@ -62,19 +62,19 @@ class Animation(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - width: int, - height: int, - duration: int, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + width: int, + height: int, + duration: int, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) @@ -91,10 +91,10 @@ class Animation(Object): @staticmethod def _parse( - client, - animation: "raw.types.Document", - video_attributes: "raw.types.DocumentAttributeVideo", - file_name: str + client, + animation: "raw.types.Document", + video_attributes: "raw.types.DocumentAttributeVideo", + file_name: str ) -> "Animation": return Animation( file_id=FileId( diff --git a/pyrogram/types/messages_and_media/audio.py b/pyrogram/types/messages_and_media/audio.py index 8359515c..60b37a59 100644 --- a/pyrogram/types/messages_and_media/audio.py +++ b/pyrogram/types/messages_and_media/audio.py @@ -62,19 +62,19 @@ class Audio(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - duration: int, - performer: str = None, - title: str = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + duration: int, + performer: str = None, + title: str = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) @@ -91,10 +91,10 @@ class Audio(Object): @staticmethod def _parse( - client, - audio: "raw.types.Document", - audio_attributes: "raw.types.DocumentAttributeAudio", - file_name: str + client, + audio: "raw.types.Document", + audio_attributes: "raw.types.DocumentAttributeAudio", + file_name: str ) -> "Audio": return Audio( file_id=FileId( diff --git a/pyrogram/types/messages_and_media/contact.py b/pyrogram/types/messages_and_media/contact.py index b8708739..cec03329 100644 --- a/pyrogram/types/messages_and_media/contact.py +++ b/pyrogram/types/messages_and_media/contact.py @@ -42,14 +42,14 @@ class Contact(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - phone_number: str, - first_name: str, - last_name: str = None, - user_id: int = None, - vcard: str = None + self, + *, + client: "pyrogram.Client" = None, + phone_number: str, + first_name: str, + last_name: str = None, + user_id: int = None, + vcard: str = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/document.py b/pyrogram/types/messages_and_media/document.py index a01c34d7..333d38ab 100644 --- a/pyrogram/types/messages_and_media/document.py +++ b/pyrogram/types/messages_and_media/document.py @@ -53,16 +53,16 @@ class Document(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/game.py b/pyrogram/types/messages_and_media/game.py index b9daffa5..1452d79e 100644 --- a/pyrogram/types/messages_and_media/game.py +++ b/pyrogram/types/messages_and_media/game.py @@ -48,15 +48,15 @@ class Game(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: int, - title: str, - short_name: str, - description: str, - photo: "types.Photo", - animation: "types.Animation" = None + self, + *, + client: "pyrogram.Client" = None, + id: int, + title: str, + short_name: str, + description: str, + photo: "types.Photo", + animation: "types.Animation" = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/location.py b/pyrogram/types/messages_and_media/location.py index f4bec4a3..664890cb 100644 --- a/pyrogram/types/messages_and_media/location.py +++ b/pyrogram/types/messages_and_media/location.py @@ -34,11 +34,11 @@ class Location(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - longitude: float, - latitude: float + self, + *, + client: "pyrogram.Client" = None, + longitude: float, + latitude: float ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index fb17f5de..02bf2d3d 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -294,78 +294,78 @@ class Message(Object, Update): # TODO: Add game missing field. Also invoice, successful_payment, connected_website def __init__( - self, - *, - client: "pyrogram.Client" = None, - message_id: int, - from_user: "types.User" = None, - sender_chat: "types.Chat" = None, - date: int = None, - chat: "types.Chat" = None, - forward_from: "types.User" = None, - forward_sender_name: str = None, - forward_from_chat: "types.Chat" = None, - forward_from_message_id: int = None, - forward_signature: str = None, - forward_date: int = None, - reply_to_message: "Message" = None, - mentioned: bool = None, - empty: bool = None, - service: str = None, - scheduled: bool = None, - from_scheduled: bool = None, - media: str = None, - edit_date: int = None, - media_group_id: str = None, - author_signature: str = None, - has_protected_content: bool = None, - text: Str = None, - entities: List["types.MessageEntity"] = None, - caption_entities: List["types.MessageEntity"] = None, - audio: "types.Audio" = None, - document: "types.Document" = None, - photo: "types.Photo" = None, - sticker: "types.Sticker" = None, - animation: "types.Animation" = None, - game: "types.Game" = None, - video: "types.Video" = None, - voice: "types.Voice" = None, - video_note: "types.VideoNote" = None, - caption: Str = None, - contact: "types.Contact" = None, - location: "types.Location" = None, - venue: "types.Venue" = None, - web_page: "types.WebPage" = None, - poll: "types.Poll" = None, - dice: "types.Dice" = None, - new_chat_members: List["types.User"] = None, - left_chat_member: "types.User" = None, - new_chat_title: str = None, - new_chat_photo: "types.Photo" = None, - delete_chat_photo: bool = None, - group_chat_created: bool = None, - supergroup_chat_created: bool = None, - channel_chat_created: bool = None, - migrate_to_chat_id: int = None, - migrate_from_chat_id: int = None, - pinned_message: "Message" = None, - game_high_score: int = None, - views: int = None, - via_bot: "types.User" = None, - outgoing: bool = None, - matches: List[Match] = None, - command: List[str] = None, - voice_chat_scheduled: "types.VoiceChatScheduled" = None, - voice_chat_started: "types.VoiceChatStarted" = None, - voice_chat_ended: "types.VoiceChatEnded" = None, - voice_chat_members_invited: "types.VoiceChatMembersInvited" = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - reactions: List["types.Reaction"] = None + self, + *, + client: "pyrogram.Client" = None, + message_id: int, + from_user: "types.User" = None, + sender_chat: "types.Chat" = None, + date: int = None, + chat: "types.Chat" = None, + forward_from: "types.User" = None, + forward_sender_name: str = None, + forward_from_chat: "types.Chat" = None, + forward_from_message_id: int = None, + forward_signature: str = None, + forward_date: int = None, + reply_to_message: "Message" = None, + mentioned: bool = None, + empty: bool = None, + service: str = None, + scheduled: bool = None, + from_scheduled: bool = None, + media: str = None, + edit_date: int = None, + media_group_id: str = None, + author_signature: str = None, + has_protected_content: bool = None, + text: Str = None, + entities: List["types.MessageEntity"] = None, + caption_entities: List["types.MessageEntity"] = None, + audio: "types.Audio" = None, + document: "types.Document" = None, + photo: "types.Photo" = None, + sticker: "types.Sticker" = None, + animation: "types.Animation" = None, + game: "types.Game" = None, + video: "types.Video" = None, + voice: "types.Voice" = None, + video_note: "types.VideoNote" = None, + caption: Str = None, + contact: "types.Contact" = None, + location: "types.Location" = None, + venue: "types.Venue" = None, + web_page: "types.WebPage" = None, + poll: "types.Poll" = None, + dice: "types.Dice" = None, + new_chat_members: List["types.User"] = None, + left_chat_member: "types.User" = None, + new_chat_title: str = None, + new_chat_photo: "types.Photo" = None, + delete_chat_photo: bool = None, + group_chat_created: bool = None, + supergroup_chat_created: bool = None, + channel_chat_created: bool = None, + migrate_to_chat_id: int = None, + migrate_from_chat_id: int = None, + pinned_message: "Message" = None, + game_high_score: int = None, + views: int = None, + via_bot: "types.User" = None, + outgoing: bool = None, + matches: List[Match] = None, + command: List[str] = None, + voice_chat_scheduled: "types.VoiceChatScheduled" = None, + voice_chat_started: "types.VoiceChatStarted" = None, + voice_chat_ended: "types.VoiceChatEnded" = None, + voice_chat_members_invited: "types.VoiceChatMembersInvited" = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + reactions: List["types.Reaction"] = None ): super().__init__(client) @@ -436,12 +436,12 @@ class Message(Object, Update): @staticmethod async def _parse( - client, - message: raw.base.Message, - users: dict, - chats: dict, - is_scheduled: bool = False, - replies: int = 1 + client, + message: raw.base.Message, + users: dict, + chats: dict, + is_scheduled: bool = False, + replies: int = 1 ): if isinstance(message, raw.types.MessageEmpty): return Message(message_id=message.id, empty=True, client=client) @@ -841,15 +841,15 @@ class Message(Object, Update): ) async def reply_text( - self, - text: str, - quote: bool = None, - parse_mode: Optional[str] = object, - entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup=None + self, + text: str, + quote: bool = None, + parse_mode: Optional[str] = object, + entities: List["types.MessageEntity"] = None, + disable_web_page_preview: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup=None ) -> "Message": """Bound method *reply_text* of :obj:`~pyrogram.types.Message`. @@ -929,26 +929,26 @@ class Message(Object, Update): reply = reply_text async def reply_animation( - self, - animation: Union[str, BinaryIO], - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - width: int = 0, - height: int = 0, - thumb: str = None, - disable_notification: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - reply_to_message_id: int = None, - progress: callable = None, - progress_args: tuple = () + self, + animation: Union[str, BinaryIO], + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + width: int = 0, + height: int = 0, + thumb: str = None, + disable_notification: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + reply_to_message_id: int = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_animation* :obj:`~pyrogram.types.Message`. @@ -1071,26 +1071,26 @@ class Message(Object, Update): ) async def reply_audio( - self, - audio: Union[str, BinaryIO], - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - performer: str = None, - title: str = None, - thumb: str = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + audio: Union[str, BinaryIO], + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + performer: str = None, + title: str = None, + thumb: str = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_audio* of :obj:`~pyrogram.types.Message`. @@ -1213,20 +1213,20 @@ class Message(Object, Update): ) async def reply_cached_media( - self, - file_id: str, - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + file_id: str, + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_cached_media* of :obj:`~pyrogram.types.Message`. @@ -1340,20 +1340,20 @@ class Message(Object, Update): ) async def reply_contact( - self, - phone_number: str, - first_name: str, - quote: bool = None, - last_name: str = "", - vcard: str = "", - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + phone_number: str, + first_name: str, + quote: bool = None, + last_name: str = "", + vcard: str = "", + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_contact* of :obj:`~pyrogram.types.Message`. @@ -1425,26 +1425,26 @@ class Message(Object, Update): ) async def reply_document( - self, - document: Union[str, BinaryIO], - quote: bool = None, - thumb: str = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - file_name: str = None, - force_document: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + document: Union[str, BinaryIO], + quote: bool = None, + thumb: str = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + file_name: str = None, + force_document: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_document* of :obj:`~pyrogram.types.Message`. @@ -1570,17 +1570,17 @@ class Message(Object, Update): ) async def reply_game( - self, - game_short_name: str, - quote: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + game_short_name: str, + quote: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_game* of :obj:`~pyrogram.types.Message`. @@ -1639,13 +1639,13 @@ class Message(Object, Update): ) async def reply_inline_bot_result( - self, - query_id: int, - result_id: str, - quote: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - hide_via: bool = None + self, + query_id: int, + result_id: str, + quote: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + hide_via: bool = None ) -> "Message": """Bound method *reply_inline_bot_result* of :obj:`~pyrogram.types.Message`. @@ -1708,18 +1708,18 @@ class Message(Object, Update): ) async def reply_location( - self, - latitude: float, - longitude: float, - quote: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + latitude: float, + longitude: float, + quote: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_location* of :obj:`~pyrogram.types.Message`. @@ -1783,11 +1783,11 @@ class Message(Object, Update): ) async def reply_media_group( - self, - media: List[Union["types.InputMediaPhoto", "types.InputMediaVideo"]], - quote: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None + self, + media: List[Union["types.InputMediaPhoto", "types.InputMediaVideo"]], + quote: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None ) -> List["types.Message"]: """Bound method *reply_media_group* of :obj:`~pyrogram.types.Message`. @@ -1844,23 +1844,23 @@ class Message(Object, Update): ) async def reply_photo( - self, - photo: Union[str, BinaryIO], - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - ttl_seconds: int = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + photo: Union[str, BinaryIO], + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + ttl_seconds: int = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_photo* of :obj:`~pyrogram.types.Message`. @@ -1970,23 +1970,23 @@ class Message(Object, Update): ) async def reply_poll( - self, - question: str, - options: List[str], - quote: bool = None, - is_anonymous: bool = True, - allows_multiple_answers: bool = None, - type: str = "regular", - correct_option_id: int = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + question: str, + options: List[str], + quote: bool = None, + is_anonymous: bool = True, + allows_multiple_answers: bool = None, + type: str = "regular", + correct_option_id: int = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_poll* of :obj:`~pyrogram.types.Message`. @@ -2074,19 +2074,19 @@ class Message(Object, Update): ) async def reply_sticker( - self, - sticker: Union[str, BinaryIO], - quote: bool = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + sticker: Union[str, BinaryIO], + quote: bool = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_sticker* of :obj:`~pyrogram.types.Message`. @@ -2174,22 +2174,22 @@ class Message(Object, Update): ) async def reply_venue( - self, - latitude: float, - longitude: float, - title: str, - address: str, - quote: bool = None, - foursquare_id: str = "", - foursquare_type: str = "", - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + self, + latitude: float, + longitude: float, + title: str, + address: str, + quote: bool = None, + foursquare_id: str = "", + foursquare_type: str = "", + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None ) -> "Message": """Bound method *reply_venue* of :obj:`~pyrogram.types.Message`. @@ -2272,28 +2272,28 @@ class Message(Object, Update): ) async def reply_video( - self, - video: Union[str, BinaryIO], - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - ttl_seconds: int = None, - duration: int = 0, - width: int = 0, - height: int = 0, - thumb: str = None, - supports_streaming: bool = True, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + video: Union[str, BinaryIO], + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + ttl_seconds: int = None, + duration: int = 0, + width: int = 0, + height: int = 0, + thumb: str = None, + supports_streaming: bool = True, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_video* of :obj:`~pyrogram.types.Message`. @@ -2426,22 +2426,22 @@ class Message(Object, Update): ) async def reply_video_note( - self, - video_note: Union[str, BinaryIO], - quote: bool = None, - duration: int = 0, - length: int = 1, - thumb: str = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + video_note: Union[str, BinaryIO], + quote: bool = None, + duration: int = 0, + length: int = 1, + thumb: str = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_video_note* of :obj:`~pyrogram.types.Message`. @@ -2544,23 +2544,23 @@ class Message(Object, Update): ) async def reply_voice( - self, - voice: Union[str, BinaryIO], - quote: bool = None, - caption: str = "", - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - duration: int = 0, - disable_notification: bool = None, - reply_to_message_id: int = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None, - progress: callable = None, - progress_args: tuple = () + self, + voice: Union[str, BinaryIO], + quote: bool = None, + caption: str = "", + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + duration: int = 0, + disable_notification: bool = None, + reply_to_message_id: int = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = None, + progress: callable = None, + progress_args: tuple = () ) -> "Message": """Bound method *reply_voice* of :obj:`~pyrogram.types.Message`. @@ -2668,12 +2668,12 @@ class Message(Object, Update): ) async def edit_text( - self, - text: str, - parse_mode: Optional[str] = object, - entities: List["types.MessageEntity"] = None, - disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + text: str, + parse_mode: Optional[str] = object, + entities: List["types.MessageEntity"] = None, + disable_web_page_preview: bool = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "Message": """Bound method *edit_text* of :obj:`~pyrogram.types.Message`. @@ -2733,11 +2733,11 @@ class Message(Object, Update): edit = edit_text async def edit_caption( - self, - caption: str, - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None + self, + caption: str, + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "Message": """Bound method *edit_caption* of :obj:`~pyrogram.types.Message`. @@ -2789,9 +2789,9 @@ class Message(Object, Update): ) async def edit_media( - self, - media: "types.InputMedia", - reply_markup: "types.InlineKeyboardMarkup" = None + self, + media: "types.InputMedia", + reply_markup: "types.InlineKeyboardMarkup" = None ) -> "Message": """Bound method *edit_media* of :obj:`~pyrogram.types.Message`. @@ -2866,10 +2866,10 @@ class Message(Object, Update): ) async def forward( - self, - chat_id: Union[int, str], - disable_notification: bool = None, - schedule_date: int = None + self, + chat_id: Union[int, str], + disable_notification: bool = None, + schedule_date: int = None ) -> Union["types.Message", List["types.Message"]]: """Bound method *forward* of :obj:`~pyrogram.types.Message`. @@ -2916,21 +2916,21 @@ class Message(Object, Update): ) async def copy( - self, - chat_id: Union[int, str], - caption: str = None, - parse_mode: Optional[str] = object, - caption_entities: List["types.MessageEntity"] = None, - disable_notification: bool = None, - reply_to_message_id: int = None, - schedule_date: int = None, - protect_content: bool = None, - reply_markup: Union[ - "types.InlineKeyboardMarkup", - "types.ReplyKeyboardMarkup", - "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = object + self, + chat_id: Union[int, str], + caption: str = None, + parse_mode: Optional[str] = object, + caption_entities: List["types.MessageEntity"] = None, + disable_notification: bool = None, + reply_to_message_id: int = None, + schedule_date: int = None, + protect_content: bool = None, + reply_markup: Union[ + "types.InlineKeyboardMarkup", + "types.ReplyKeyboardMarkup", + "types.ReplyKeyboardRemove", + "types.ForceReply" + ] = object ) -> Union["types.Message", List["types.Message"]]: """Bound method *copy* of :obj:`~pyrogram.types.Message`. @@ -3263,7 +3263,7 @@ class Message(Object, Update): await self.reply(button, quote=quote) async def retract_vote( - self, + self, ) -> "types.Poll": """Bound method *retract_vote* of :obj:`~pyrogram.types.Message`. @@ -3294,11 +3294,11 @@ class Message(Object, Update): ) async def download( - self, - file_name: str = "", - block: bool = True, - progress: callable = None, - progress_args: tuple = () + self, + file_name: str = "", + block: bool = True, + progress: callable = None, + progress_args: tuple = () ) -> str: """Bound method *download* of :obj:`~pyrogram.types.Message`. @@ -3362,8 +3362,8 @@ class Message(Object, Update): ) async def vote( - self, - option: int, + self, + option: int, ) -> "types.Poll": """Bound method *vote* of :obj:`~pyrogram.types.Message`. diff --git a/pyrogram/types/messages_and_media/message_entity.py b/pyrogram/types/messages_and_media/message_entity.py index c05162bd..2595fc66 100644 --- a/pyrogram/types/messages_and_media/message_entity.py +++ b/pyrogram/types/messages_and_media/message_entity.py @@ -115,15 +115,15 @@ class MessageEntity(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - type: str, - offset: int, - length: int, - url: str = None, - user: "types.User" = None, - language: str = None + self, + *, + client: "pyrogram.Client" = None, + type: str, + offset: int, + length: int, + url: str = None, + user: "types.User" = None, + language: str = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/photo.py b/pyrogram/types/messages_and_media/photo.py index 685899c6..fc496cd4 100644 --- a/pyrogram/types/messages_and_media/photo.py +++ b/pyrogram/types/messages_and_media/photo.py @@ -56,17 +56,17 @@ class Photo(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - width: int, - height: int, - file_size: int, - date: int, - ttl_seconds: int = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + width: int, + height: int, + file_size: int, + date: int, + ttl_seconds: int = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/poll.py b/pyrogram/types/messages_and_media/poll.py index f97c04a1..8d46557d 100644 --- a/pyrogram/types/messages_and_media/poll.py +++ b/pyrogram/types/messages_and_media/poll.py @@ -58,19 +58,19 @@ class Poll(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: str, - question: str, - options: List["types.PollOption"], - total_voter_count: int, - is_closed: bool, - is_anonymous: bool = None, - type: str = None, - allows_multiple_answers: bool = None, - # correct_option_id: int, - chosen_option: int = None + self, + *, + client: "pyrogram.Client" = None, + id: str, + question: str, + options: List["types.PollOption"], + total_voter_count: int, + is_closed: bool, + is_anonymous: bool = None, + type: str = None, + allows_multiple_answers: bool = None, + # correct_option_id: int, + chosen_option: int = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/poll_option.py b/pyrogram/types/messages_and_media/poll_option.py index c52b8446..a40926b0 100644 --- a/pyrogram/types/messages_and_media/poll_option.py +++ b/pyrogram/types/messages_and_media/poll_option.py @@ -36,12 +36,12 @@ class PollOption(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - text: str, - voter_count: int, - data: bytes + self, + *, + client: "pyrogram.Client" = None, + text: str, + voter_count: int, + data: bytes ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/reaction.py b/pyrogram/types/messages_and_media/reaction.py index aa365595..83dda582 100644 --- a/pyrogram/types/messages_and_media/reaction.py +++ b/pyrogram/types/messages_and_media/reaction.py @@ -35,12 +35,12 @@ class Reaction(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - emoji: str, - count: int, - chosen: bool + self, + *, + client: "pyrogram.Client" = None, + emoji: str, + count: int, + chosen: bool ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/sticker.py b/pyrogram/types/messages_and_media/sticker.py index d2748573..be494e30 100644 --- a/pyrogram/types/messages_and_media/sticker.py +++ b/pyrogram/types/messages_and_media/sticker.py @@ -71,21 +71,21 @@ class Sticker(Object): # TODO: Add mask position def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - width: int, - height: int, - is_animated: bool, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - emoji: str = None, - set_name: str = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + width: int, + height: int, + is_animated: bool, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + emoji: str = None, + set_name: str = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) @@ -138,11 +138,11 @@ class Sticker(Object): @staticmethod async def _parse( - client, - sticker: "raw.types.Document", - image_size_attributes: "raw.types.DocumentAttributeImageSize", - sticker_attributes: "raw.types.DocumentAttributeSticker", - file_name: str + client, + sticker: "raw.types.Document", + image_size_attributes: "raw.types.DocumentAttributeImageSize", + sticker_attributes: "raw.types.DocumentAttributeSticker", + file_name: str ) -> "Sticker": sticker_set = sticker_attributes.stickerset diff --git a/pyrogram/types/messages_and_media/stripped_thumbnail.py b/pyrogram/types/messages_and_media/stripped_thumbnail.py index fe542092..e9756607 100644 --- a/pyrogram/types/messages_and_media/stripped_thumbnail.py +++ b/pyrogram/types/messages_and_media/stripped_thumbnail.py @@ -30,10 +30,10 @@ class StrippedThumbnail(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - data: bytes + self, + *, + client: "pyrogram.Client" = None, + data: bytes ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/thumbnail.py b/pyrogram/types/messages_and_media/thumbnail.py index 1a99ab53..b9cb93e1 100644 --- a/pyrogram/types/messages_and_media/thumbnail.py +++ b/pyrogram/types/messages_and_media/thumbnail.py @@ -46,14 +46,14 @@ class Thumbnail(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - width: int, - height: int, - file_size: int + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + width: int, + height: int, + file_size: int ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/venue.py b/pyrogram/types/messages_and_media/venue.py index 6b69069d..8a26f600 100644 --- a/pyrogram/types/messages_and_media/venue.py +++ b/pyrogram/types/messages_and_media/venue.py @@ -45,14 +45,14 @@ class Venue(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - location: "types.Location", - title: str, - address: str, - foursquare_id: str = None, - foursquare_type: str = None + self, + *, + client: "pyrogram.Client" = None, + location: "types.Location", + title: str, + address: str, + foursquare_id: str = None, + foursquare_type: str = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/video.py b/pyrogram/types/messages_and_media/video.py index aaefb580..1cdf055f 100644 --- a/pyrogram/types/messages_and_media/video.py +++ b/pyrogram/types/messages_and_media/video.py @@ -68,21 +68,21 @@ class Video(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - width: int, - height: int, - duration: int, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - supports_streaming: bool = None, - ttl_seconds: int = None, - date: int = None, - thumbs: List["types.Thumbnail"] = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + width: int, + height: int, + duration: int, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + supports_streaming: bool = None, + ttl_seconds: int = None, + date: int = None, + thumbs: List["types.Thumbnail"] = None ): super().__init__(client) @@ -101,11 +101,11 @@ class Video(Object): @staticmethod def _parse( - client, - video: "raw.types.Document", - video_attributes: "raw.types.DocumentAttributeVideo", - file_name: str, - ttl_seconds: int = None + client, + video: "raw.types.Document", + video_attributes: "raw.types.DocumentAttributeVideo", + file_name: str, + ttl_seconds: int = None ) -> "Video": return Video( file_id=FileId( diff --git a/pyrogram/types/messages_and_media/video_note.py b/pyrogram/types/messages_and_media/video_note.py index 3cf0d99a..3a9e8a61 100644 --- a/pyrogram/types/messages_and_media/video_note.py +++ b/pyrogram/types/messages_and_media/video_note.py @@ -56,17 +56,17 @@ class VideoNote(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - length: int, - duration: int, - thumbs: List["types.Thumbnail"] = None, - mime_type: str = None, - file_size: int = None, - date: int = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + length: int, + duration: int, + thumbs: List["types.Thumbnail"] = None, + mime_type: str = None, + file_size: int = None, + date: int = None ): super().__init__(client) @@ -81,9 +81,9 @@ class VideoNote(Object): @staticmethod def _parse( - client, - video_note: "raw.types.Document", - video_attributes: "raw.types.DocumentAttributeVideo" + client, + video_note: "raw.types.Document", + video_attributes: "raw.types.DocumentAttributeVideo" ) -> "VideoNote": return VideoNote( file_id=FileId( diff --git a/pyrogram/types/messages_and_media/voice.py b/pyrogram/types/messages_and_media/voice.py index a6b60bf0..4175b7ba 100644 --- a/pyrogram/types/messages_and_media/voice.py +++ b/pyrogram/types/messages_and_media/voice.py @@ -50,16 +50,16 @@ class Voice(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - file_id: str, - file_unique_id: str, - duration: int, - waveform: bytes = None, - mime_type: str = None, - file_size: int = None, - date: int = None + self, + *, + client: "pyrogram.Client" = None, + file_id: str, + file_unique_id: str, + duration: int, + waveform: bytes = None, + mime_type: str = None, + file_size: int = None, + date: int = None ): super().__init__(client) diff --git a/pyrogram/types/messages_and_media/webpage.py b/pyrogram/types/messages_and_media/webpage.py index d2ffbe89..34e51d88 100644 --- a/pyrogram/types/messages_and_media/webpage.py +++ b/pyrogram/types/messages_and_media/webpage.py @@ -85,27 +85,27 @@ class WebPage(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: str, - url: str, - display_url: str, - type: str = None, - site_name: str = None, - title: str = None, - description: str = None, - audio: "types.Audio" = None, - document: "types.Document" = None, - photo: "types.Photo" = None, - animation: "types.Animation" = None, - video: "types.Video" = None, - embed_url: str = None, - embed_type: str = None, - embed_width: int = None, - embed_height: int = None, - duration: int = None, - author: str = None + self, + *, + client: "pyrogram.Client" = None, + id: str, + url: str, + display_url: str, + type: str = None, + site_name: str = None, + title: str = None, + description: str = None, + audio: "types.Audio" = None, + document: "types.Document" = None, + photo: "types.Photo" = None, + animation: "types.Animation" = None, + video: "types.Video" = None, + embed_url: str = None, + embed_type: str = None, + embed_width: int = None, + embed_height: int = None, + duration: int = None, + author: str = None ): super().__init__(client) diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index cbe598f3..a9d396eb 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -131,37 +131,37 @@ class Chat(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: int, - type: str, - is_verified: bool = None, - is_restricted: bool = None, - is_creator: bool = None, - is_scam: bool = None, - is_fake: bool = None, - is_support: bool = None, - title: str = None, - username: str = None, - first_name: str = None, - last_name: str = None, - photo: "types.ChatPhoto" = None, - bio: str = None, - description: str = None, - dc_id: int = None, - has_protected_content: bool = None, - invite_link: str = None, - pinned_message=None, - sticker_set_name: str = None, - can_set_sticker_set: bool = None, - members_count: int = None, - restrictions: List["types.Restriction"] = None, - permissions: "types.ChatPermissions" = None, - distance: int = None, - linked_chat: "types.Chat" = None, - send_as_chat: "types.Chat" = None, - available_reactions: List[str] = None + self, + *, + client: "pyrogram.Client" = None, + id: int, + type: str, + is_verified: bool = None, + is_restricted: bool = None, + is_creator: bool = None, + is_scam: bool = None, + is_fake: bool = None, + is_support: bool = None, + title: str = None, + username: str = None, + first_name: str = None, + last_name: str = None, + photo: "types.ChatPhoto" = None, + bio: str = None, + description: str = None, + dc_id: int = None, + has_protected_content: bool = None, + invite_link: str = None, + pinned_message=None, + sticker_set_name: str = None, + can_set_sticker_set: bool = None, + members_count: int = None, + restrictions: List["types.Restriction"] = None, + permissions: "types.ChatPermissions" = None, + distance: int = None, + linked_chat: "types.Chat" = None, + send_as_chat: "types.Chat" = None, + available_reactions: List[str] = None ): super().__init__(client) @@ -258,11 +258,11 @@ class Chat(Object): @staticmethod def _parse( - client, - message: Union[raw.types.Message, raw.types.MessageService], - users: dict, - chats: dict, - is_chat: bool + client, + message: Union[raw.types.Message, raw.types.MessageService], + users: dict, + chats: dict, + is_chat: bool ) -> "Chat": from_id = utils.get_raw_peer_id(message.from_id) peer_id = utils.get_raw_peer_id(message.peer_id) @@ -510,9 +510,9 @@ class Chat(Object): ) async def ban_member( - self, - user_id: Union[int, str], - until_date: int = 0 + self, + user_id: Union[int, str], + until_date: int = 0 ) -> Union["types.Message", bool]: """Bound method *ban_member* of :obj:`~pyrogram.types.Chat`. @@ -560,8 +560,8 @@ class Chat(Object): ) async def unban_member( - self, - user_id: Union[int, str] + self, + user_id: Union[int, str] ) -> bool: """Bound method *unban_member* of :obj:`~pyrogram.types.Chat`. @@ -597,10 +597,10 @@ class Chat(Object): ) async def restrict_member( - self, - user_id: Union[int, str], - permissions: "types.ChatPermissions", - until_date: int = 0, + self, + user_id: Union[int, str], + permissions: "types.ChatPermissions", + until_date: int = 0, ) -> "types.Chat": """Bound method *unban_member* of :obj:`~pyrogram.types.Chat`. @@ -647,18 +647,18 @@ class Chat(Object): ) async def promote_member( - self, - user_id: Union[int, str], - can_manage_chat: bool = True, - can_change_info: bool = True, - can_post_messages: bool = False, - can_edit_messages: bool = False, - can_delete_messages: bool = True, - can_restrict_members: bool = True, - can_invite_users: bool = True, - can_pin_messages: bool = False, - can_promote_members: bool = False, - can_manage_voice_chats: bool = False + self, + user_id: Union[int, str], + can_manage_chat: bool = True, + can_change_info: bool = True, + can_post_messages: bool = False, + can_edit_messages: bool = False, + can_delete_messages: bool = True, + can_restrict_members: bool = True, + can_invite_users: bool = True, + can_pin_messages: bool = False, + can_promote_members: bool = False, + can_manage_voice_chats: bool = False ) -> bool: """Bound method *promote_member* of :obj:`~pyrogram.types.Chat`. @@ -808,8 +808,8 @@ class Chat(Object): return await self._client.export_chat_invite_link(self.id) async def get_member( - self, - user_id: Union[int, str], + self, + user_id: Union[int, str], ) -> "types.ChatMember": """Bound method *get_member* of :obj:`~pyrogram.types.Chat`. @@ -837,11 +837,11 @@ class Chat(Object): ) async def get_members( - self, - offset: int = 0, - limit: int = 200, - query: str = "", - filter: str = "all" + self, + offset: int = 0, + limit: int = 200, + query: str = "", + filter: str = "all" ) -> List["types.ChatMember"]: """Bound method *get_members* of :obj:`~pyrogram.types.Chat`. @@ -908,10 +908,10 @@ class Chat(Object): ) def iter_members( - self, - limit: int = 0, - query: str = "", - filter: str = "all" + self, + limit: int = 0, + query: str = "", + filter: str = "all" ) -> Optional[Generator["types.ChatMember", None, None]]: """Bound method *iter_members* of :obj:`~pyrogram.types.Chat`. @@ -973,9 +973,9 @@ class Chat(Object): ) async def add_members( - self, - user_ids: Union[Union[int, str], List[Union[int, str]]], - forward_limit: int = 100 + self, + user_ids: Union[Union[int, str], List[Union[int, str]]], + forward_limit: int = 100 ) -> bool: """Bound method *add_members* of :obj:`~pyrogram.types.Chat`. diff --git a/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py index 0ab91ce1..385a38da 100644 --- a/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py +++ b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py @@ -39,10 +39,10 @@ class ChatAdminWithInviteLinks(Object): """ def __init__( - self, *, - admin: "types.User", - chat_invite_links_count: int, - revoked_chat_invite_links_count: int = None + self, *, + admin: "types.User", + chat_invite_links_count: int, + revoked_chat_invite_links_count: int = None ): super().__init__() @@ -52,9 +52,9 @@ class ChatAdminWithInviteLinks(Object): @staticmethod def _parse( - client: "pyrogram.Client", - admin: "raw.types.ChatAdminWithInvites", - users: Dict[int, "raw.types.User"] = None + client: "pyrogram.Client", + admin: "raw.types.ChatAdminWithInvites", + users: Dict[int, "raw.types.User"] = None ) -> "ChatAdminWithInviteLinks": return ChatAdminWithInviteLinks( admin=types.User._parse(client, users[admin.admin_id]), diff --git a/pyrogram/types/user_and_chats/chat_event.py b/pyrogram/types/user_and_chats/chat_event.py index 27dc0e2b..374dac50 100644 --- a/pyrogram/types/user_and_chats/chat_event.py +++ b/pyrogram/types/user_and_chats/chat_event.py @@ -245,64 +245,64 @@ class ChatEvent(Object): """ def __init__( - self, *, - id: int, - date: int, - user: "types.User", - action: str, + self, *, + id: int, + date: int, + user: "types.User", + action: str, - old_description: str = None, - new_description: str = None, + old_description: str = None, + new_description: str = None, - old_history_ttl: int = None, - new_history_ttl: int = None, + old_history_ttl: int = None, + new_history_ttl: int = None, - old_linked_chat: "types.Chat" = None, - new_linked_chat: "types.Chat" = None, + old_linked_chat: "types.Chat" = None, + new_linked_chat: "types.Chat" = None, - old_photo: "types.Photo" = None, - new_photo: "types.Photo" = None, + old_photo: "types.Photo" = None, + new_photo: "types.Photo" = None, - old_title: str = None, - new_title: str = None, + old_title: str = None, + new_title: str = None, - old_username: str = None, - new_username: str = None, + old_username: str = None, + new_username: str = None, - old_chat_permissions: "types.ChatPermissions" = None, - new_chat_permissions: "types.ChatPermissions" = None, + old_chat_permissions: "types.ChatPermissions" = None, + new_chat_permissions: "types.ChatPermissions" = None, - deleted_message: "types.Message" = None, + deleted_message: "types.Message" = None, - old_message: "types.Message" = None, - new_message: "types.Message" = None, + old_message: "types.Message" = None, + new_message: "types.Message" = None, - invited_member: "types.ChatMember" = None, + invited_member: "types.ChatMember" = None, - old_admin_rights: "types.ChatMember" = None, - new_admin_rights: "types.ChatMember" = None, + old_admin_rights: "types.ChatMember" = None, + new_admin_rights: "types.ChatMember" = None, - old_member_permissions: "types.ChatMember" = None, - new_member_permissions: "types.ChatMember" = None, + old_member_permissions: "types.ChatMember" = None, + new_member_permissions: "types.ChatMember" = None, - stopped_poll: "types.Message" = None, + stopped_poll: "types.Message" = None, - invites_enabled: "types.ChatMember" = None, + invites_enabled: "types.ChatMember" = None, - history_hidden: bool = None, + history_hidden: bool = None, - signatures_enabled: bool = None, + signatures_enabled: bool = None, - old_slow_mode: int = None, - new_slow_mode: int = None, + old_slow_mode: int = None, + new_slow_mode: int = None, - pinned_message: "types.Message" = None, - unpinned_message: "types.Message" = None, + pinned_message: "types.Message" = None, + unpinned_message: "types.Message" = None, - old_invite_link: "types.ChatInviteLink" = None, - new_invite_link: "types.ChatInviteLink" = None, - revoked_invite_link: "types.ChatInviteLink" = None, - deleted_invite_link: "types.ChatInviteLink" = None, + old_invite_link: "types.ChatInviteLink" = None, + new_invite_link: "types.ChatInviteLink" = None, + revoked_invite_link: "types.ChatInviteLink" = None, + deleted_invite_link: "types.ChatInviteLink" = None, ): super().__init__() @@ -366,10 +366,10 @@ class ChatEvent(Object): @staticmethod async def _parse( - client: "pyrogram.Client", - event: "raw.base.ChannelAdminLogEvent", - users: List["raw.base.User"], - chats: List["raw.base.Chat"] + client: "pyrogram.Client", + event: "raw.base.ChannelAdminLogEvent", + users: List["raw.base.User"], + chats: List["raw.base.Chat"] ): users = {i.id: i for i in users} chats = {i.id: i for i in chats} diff --git a/pyrogram/types/user_and_chats/chat_event_filter.py b/pyrogram/types/user_and_chats/chat_event_filter.py index 0b7d787c..d88300ba 100644 --- a/pyrogram/types/user_and_chats/chat_event_filter.py +++ b/pyrogram/types/user_and_chats/chat_event_filter.py @@ -72,18 +72,18 @@ class ChatEventFilter(Object): """ def __init__( - self, *, - new_restrictions: bool = False, - admin_rights: bool = False, - new_members: bool = False, - chat_info: bool = False, - chat_settings: bool = False, - invite_links: bool = False, - deleted_messages: bool = False, - edited_messages: bool = False, - pinned_messages: bool = False, - leaving_members: bool = False, - voice_chats: bool = False + self, *, + new_restrictions: bool = False, + admin_rights: bool = False, + new_members: bool = False, + chat_info: bool = False, + chat_settings: bool = False, + invite_links: bool = False, + deleted_messages: bool = False, + edited_messages: bool = False, + pinned_messages: bool = False, + leaving_members: bool = False, + voice_chats: bool = False ): super().__init__() diff --git a/pyrogram/types/user_and_chats/chat_invite_link.py b/pyrogram/types/user_and_chats/chat_invite_link.py index 51b87bac..9dddea48 100644 --- a/pyrogram/types/user_and_chats/chat_invite_link.py +++ b/pyrogram/types/user_and_chats/chat_invite_link.py @@ -65,19 +65,19 @@ class ChatInviteLink(Object): """ def __init__( - self, *, - invite_link: str, - date: int, - is_primary: bool = None, - is_revoked: bool = None, - creator: "types.User" = None, - name: str = None, - creates_join_request: bool = None, - start_date: int = None, - expire_date: int = None, - member_limit: int = None, - member_count: int = None, - pending_join_request_count: int = None + self, *, + invite_link: str, + date: int, + is_primary: bool = None, + is_revoked: bool = None, + creator: "types.User" = None, + name: str = None, + creates_join_request: bool = None, + start_date: int = None, + expire_date: int = None, + member_limit: int = None, + member_count: int = None, + pending_join_request_count: int = None ): super().__init__() @@ -96,9 +96,9 @@ class ChatInviteLink(Object): @staticmethod def _parse( - client: "pyrogram.Client", - invite: "raw.base.ExportedChatInvite", - users: Dict[int, "raw.types.User"] = None + client: "pyrogram.Client", + invite: "raw.base.ExportedChatInvite", + users: Dict[int, "raw.types.User"] = None ) -> "ChatInviteLink": creator = ( types.User._parse(client, users[invite.admin_id]) diff --git a/pyrogram/types/user_and_chats/chat_join_request.py b/pyrogram/types/user_and_chats/chat_join_request.py index 8daf366a..a7001da5 100644 --- a/pyrogram/types/user_and_chats/chat_join_request.py +++ b/pyrogram/types/user_and_chats/chat_join_request.py @@ -46,14 +46,14 @@ class ChatJoinRequest(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - chat: "types.Chat", - from_user: "types.User", - date: int, - bio: str = None, - invite_link: "types.ChatInviteLink" = None + self, + *, + client: "pyrogram.Client" = None, + chat: "types.Chat", + from_user: "types.User", + date: int, + bio: str = None, + invite_link: "types.ChatInviteLink" = None ): super().__init__(client) @@ -65,10 +65,10 @@ class ChatJoinRequest(Object, Update): @staticmethod def _parse( - client: "pyrogram.Client", - update: "raw.types.UpdateBotChatInviteRequester", - users: Dict[int, "raw.types.User"], - chats: Dict[int, "raw.types.Chat"] + client: "pyrogram.Client", + update: "raw.types.UpdateBotChatInviteRequester", + users: Dict[int, "raw.types.User"], + chats: Dict[int, "raw.types.Chat"] ) -> "ChatJoinRequest": chat_id = utils.get_raw_peer_id(update.peer) diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py index 4fc67308..ff550815 100644 --- a/pyrogram/types/user_and_chats/chat_member.py +++ b/pyrogram/types/user_and_chats/chat_member.py @@ -140,42 +140,42 @@ class ChatMember(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - user: "types.User", - status: str, - title: str = None, - until_date: int = None, - joined_date: int = None, - invited_by: "types.User" = None, - promoted_by: "types.User" = None, - restricted_by: "types.User" = None, - is_member: bool = None, - is_anonymous: bool = None, + self, + *, + client: "pyrogram.Client" = None, + user: "types.User", + status: str, + title: str = None, + until_date: int = None, + joined_date: int = None, + invited_by: "types.User" = None, + promoted_by: "types.User" = None, + restricted_by: "types.User" = None, + is_member: bool = None, + is_anonymous: bool = None, - # Admin permissions - can_be_edited: bool = None, - can_manage_chat: bool = None, - can_post_messages: bool = None, # Channels only - can_edit_messages: bool = None, # Channels only - can_delete_messages: bool = None, - can_restrict_members: bool = None, - can_promote_members: bool = None, - can_change_info: bool = None, - can_invite_users: bool = None, - can_pin_messages: bool = None, # Groups and supergroups only - can_manage_voice_chats: bool = None, + # Admin permissions + can_be_edited: bool = None, + can_manage_chat: bool = None, + can_post_messages: bool = None, # Channels only + can_edit_messages: bool = None, # Channels only + can_delete_messages: bool = None, + can_restrict_members: bool = None, + can_promote_members: bool = None, + can_change_info: bool = None, + can_invite_users: bool = None, + can_pin_messages: bool = None, # Groups and supergroups only + can_manage_voice_chats: bool = None, - # Restricted user permissions - can_send_messages: bool = None, # Text, contacts, locations and venues - can_send_media_messages: bool = None, # Audios, documents, photos, videos, video notes and voice notes - can_send_stickers: bool = None, - can_send_animations: bool = None, - can_send_games: bool = None, - can_use_inline_bots: bool = None, - can_add_web_page_previews: bool = None, - can_send_polls: bool = None + # Restricted user permissions + can_send_messages: bool = None, # Text, contacts, locations and venues + can_send_media_messages: bool = None, # Audios, documents, photos, videos, video notes and voice notes + can_send_stickers: bool = None, + can_send_animations: bool = None, + can_send_games: bool = None, + can_use_inline_bots: bool = None, + can_add_web_page_previews: bool = None, + can_send_polls: bool = None ): super().__init__(client) diff --git a/pyrogram/types/user_and_chats/chat_member_updated.py b/pyrogram/types/user_and_chats/chat_member_updated.py index 448bcae6..5fa7d84e 100644 --- a/pyrogram/types/user_and_chats/chat_member_updated.py +++ b/pyrogram/types/user_and_chats/chat_member_updated.py @@ -49,15 +49,15 @@ class ChatMemberUpdated(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - chat: "types.Chat", - from_user: "types.User", - date: int, - old_chat_member: "types.ChatMember", - new_chat_member: "types.ChatMember", - invite_link: "types.ChatInviteLink" = None, + self, + *, + client: "pyrogram.Client" = None, + chat: "types.Chat", + from_user: "types.User", + date: int, + old_chat_member: "types.ChatMember", + new_chat_member: "types.ChatMember", + invite_link: "types.ChatInviteLink" = None, ): super().__init__(client) @@ -70,10 +70,10 @@ class ChatMemberUpdated(Object, Update): @staticmethod def _parse( - client: "pyrogram.Client", - update: Union["raw.types.UpdateChatParticipant", "raw.types.UpdateChannelParticipant"], - users: Dict[int, "raw.types.User"], - chats: Dict[int, "raw.types.Chat"] + client: "pyrogram.Client", + update: Union["raw.types.UpdateChatParticipant", "raw.types.UpdateChannelParticipant"], + users: Dict[int, "raw.types.User"], + chats: Dict[int, "raw.types.Chat"] ) -> "ChatMemberUpdated": chat_id = getattr(update, "chat_id", None) or getattr(update, "channel_id") diff --git a/pyrogram/types/user_and_chats/chat_permissions.py b/pyrogram/types/user_and_chats/chat_permissions.py index ed7b65ff..e209625a 100644 --- a/pyrogram/types/user_and_chats/chat_permissions.py +++ b/pyrogram/types/user_and_chats/chat_permissions.py @@ -56,16 +56,16 @@ class ChatPermissions(Object): """ def __init__( - self, - *, - can_send_messages: bool = None, # Text, contacts, locations and venues - can_send_media_messages: bool = None, # Audio files, documents, photos, videos, video notes and voice notes - can_send_other_messages: bool = None, # Stickers, animations, games, inline bots - can_send_polls: bool = None, - can_add_web_page_previews: bool = None, - can_change_info: bool = None, - can_invite_users: bool = None, - can_pin_messages: bool = None + self, + *, + can_send_messages: bool = None, # Text, contacts, locations and venues + can_send_media_messages: bool = None, # Audio files, documents, photos, videos, video notes and voice notes + can_send_other_messages: bool = None, # Stickers, animations, games, inline bots + can_send_polls: bool = None, + can_add_web_page_previews: bool = None, + can_change_info: bool = None, + can_invite_users: bool = None, + can_pin_messages: bool = None ): super().__init__(None) diff --git a/pyrogram/types/user_and_chats/chat_photo.py b/pyrogram/types/user_and_chats/chat_photo.py index 74ebe4ed..b3aba61d 100644 --- a/pyrogram/types/user_and_chats/chat_photo.py +++ b/pyrogram/types/user_and_chats/chat_photo.py @@ -46,13 +46,13 @@ class ChatPhoto(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - small_file_id: str, - small_photo_unique_id: str, - big_file_id: str, - big_photo_unique_id: str + self, + *, + client: "pyrogram.Client" = None, + small_file_id: str, + small_photo_unique_id: str, + big_file_id: str, + big_photo_unique_id: str ): super().__init__(client) @@ -64,10 +64,10 @@ class ChatPhoto(Object): @staticmethod def _parse( - client, - chat_photo: Union["raw.types.UserProfilePhoto", "raw.types.ChatPhoto"], - peer_id: int, - peer_access_hash: int + client, + chat_photo: Union["raw.types.UserProfilePhoto", "raw.types.ChatPhoto"], + peer_id: int, + peer_access_hash: int ): if not isinstance(chat_photo, (raw.types.UserProfilePhoto, raw.types.ChatPhoto)): return None diff --git a/pyrogram/types/user_and_chats/chat_preview.py b/pyrogram/types/user_and_chats/chat_preview.py index 231f26fb..e251c865 100644 --- a/pyrogram/types/user_and_chats/chat_preview.py +++ b/pyrogram/types/user_and_chats/chat_preview.py @@ -45,14 +45,14 @@ class ChatPreview(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - title: str, - type: str, - members_count: int, - photo: "types.Photo" = None, - members: List["types.User"] = None + self, + *, + client: "pyrogram.Client" = None, + title: str, + type: str, + members_count: int, + photo: "types.Photo" = None, + members: List["types.User"] = None ): super().__init__(client) diff --git a/pyrogram/types/user_and_chats/dialog.py b/pyrogram/types/user_and_chats/dialog.py index 2db706b6..7259a89a 100644 --- a/pyrogram/types/user_and_chats/dialog.py +++ b/pyrogram/types/user_and_chats/dialog.py @@ -47,15 +47,15 @@ class Dialog(Object): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - chat: "types.Chat", - top_message: "types.Message", - unread_messages_count: int, - unread_mentions_count: int, - unread_mark: bool, - is_pinned: bool + self, + *, + client: "pyrogram.Client" = None, + chat: "types.Chat", + top_message: "types.Message", + unread_messages_count: int, + unread_mentions_count: int, + unread_mark: bool, + is_pinned: bool ): super().__init__(client) diff --git a/pyrogram/types/user_and_chats/user.py b/pyrogram/types/user_and_chats/user.py index c9bcdde3..8579ba15 100644 --- a/pyrogram/types/user_and_chats/user.py +++ b/pyrogram/types/user_and_chats/user.py @@ -150,31 +150,31 @@ class User(Object, Update): """ def __init__( - self, - *, - client: "pyrogram.Client" = None, - id: int, - is_self: bool = None, - is_contact: bool = None, - is_mutual_contact: bool = None, - is_deleted: bool = None, - is_bot: bool = None, - is_verified: bool = None, - is_restricted: bool = None, - is_scam: bool = None, - is_fake: bool = None, - is_support: bool = None, - first_name: str = None, - last_name: str = None, - status: str = None, - last_online_date: int = None, - next_offline_date: int = None, - username: str = None, - language_code: str = None, - dc_id: int = None, - phone_number: str = None, - photo: "types.ChatPhoto" = None, - restrictions: List["types.Restriction"] = None + self, + *, + client: "pyrogram.Client" = None, + id: int, + is_self: bool = None, + is_contact: bool = None, + is_mutual_contact: bool = None, + is_deleted: bool = None, + is_bot: bool = None, + is_verified: bool = None, + is_restricted: bool = None, + is_scam: bool = None, + is_fake: bool = None, + is_support: bool = None, + first_name: str = None, + last_name: str = None, + status: str = None, + last_online_date: int = None, + next_offline_date: int = None, + username: str = None, + language_code: str = None, + dc_id: int = None, + phone_number: str = None, + photo: "types.ChatPhoto" = None, + restrictions: List["types.Restriction"] = None ): super().__init__(client) diff --git a/pyrogram/types/user_and_chats/voice_chat_ended.py b/pyrogram/types/user_and_chats/voice_chat_ended.py index a27599a3..b6b05fea 100644 --- a/pyrogram/types/user_and_chats/voice_chat_ended.py +++ b/pyrogram/types/user_and_chats/voice_chat_ended.py @@ -29,8 +29,8 @@ class VoiceChatEnded(Object): """ def __init__( - self, *, - duration: int + self, *, + duration: int ): super().__init__() diff --git a/pyrogram/types/user_and_chats/voice_chat_members_invited.py b/pyrogram/types/user_and_chats/voice_chat_members_invited.py index 6ac48160..0fd4249b 100644 --- a/pyrogram/types/user_and_chats/voice_chat_members_invited.py +++ b/pyrogram/types/user_and_chats/voice_chat_members_invited.py @@ -32,8 +32,8 @@ class VoiceChatMembersInvited(Object): """ def __init__( - self, *, - users: List["types.User"] + self, *, + users: List["types.User"] ): super().__init__() @@ -41,9 +41,9 @@ class VoiceChatMembersInvited(Object): @staticmethod def _parse( - client, - action: "raw.types.MessageActionInviteToGroupCall", - users: Dict[int, "raw.types.User"] + client, + action: "raw.types.MessageActionInviteToGroupCall", + users: Dict[int, "raw.types.User"] ) -> "VoiceChatMembersInvited": users = [types.User._parse(client, users[i]) for i in action.users] diff --git a/pyrogram/types/user_and_chats/voice_chat_scheduled.py b/pyrogram/types/user_and_chats/voice_chat_scheduled.py index 2e83fb45..82d2125e 100644 --- a/pyrogram/types/user_and_chats/voice_chat_scheduled.py +++ b/pyrogram/types/user_and_chats/voice_chat_scheduled.py @@ -29,8 +29,8 @@ class VoiceChatScheduled(Object): """ def __init__( - self, *, - start_date: int + self, *, + start_date: int ): super().__init__() diff --git a/pyrogram/utils.py b/pyrogram/utils.py index b678f061..6a0c8bac 100644 --- a/pyrogram/utils.py +++ b/pyrogram/utils.py @@ -40,8 +40,8 @@ async def ainput(prompt: str = "", *, hide: bool = False): def get_input_media_from_file_id( - file_id: str, - expected_file_type: FileType = None + file_id: str, + expected_file_type: FileType = None ) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]: try: decoded = FileId.decode(file_id) @@ -292,10 +292,10 @@ def compute_password_check(r: raw.types.account.Password, password: str) -> raw. async def parse_text_entities( - client: "pyrogram.Client", - text: str, - parse_mode: str, - entities: List["types.MessageEntity"] + client: "pyrogram.Client", + text: str, + parse_mode: str, + entities: List["types.MessageEntity"] ) -> Dict[str, raw.base.MessageEntity]: if entities: # Inject the client instance because parsing user mentions requires it