diff --git a/pyrogram/api/core/object.py b/pyrogram/api/core/object.py index a479fb6e..ace7a59a 100644 --- a/pyrogram/api/core/object.py +++ b/pyrogram/api/core/object.py @@ -30,43 +30,51 @@ class Object: QUALNAME = "Base" @staticmethod - def read(b: BytesIO, *args): + def read(b: BytesIO, *args): # TODO: Rename b -> data return Object.all[int.from_bytes(b.read(4), "little")].read(b, *args) def write(self, *args) -> bytes: pass + def __eq__(self, other: "Object") -> bool: + for attr in self.__slots__: + try: + if getattr(self, attr) != getattr(other, attr): + return False + except AttributeError: + return False + + return True + def __str__(self) -> str: + def default(obj: Object): + try: + return OrderedDict( + [("_", obj.QUALNAME)] + + [(attr, getattr(obj, attr)) + for attr in obj.__slots__ + if getattr(obj, attr) is not None] + ) + except AttributeError: + if isinstance(obj, datetime): + return obj.strftime("%d-%b-%Y %H:%M:%S") + else: + return repr(obj) + return dumps(self, indent=4, default=default, ensure_ascii=False) + def __repr__(self) -> str: + return "pyrogram.api.{}({})".format( + self.QUALNAME, + ", ".join( + "{}={}".format(attr, repr(getattr(self, attr))) + for attr in self.__slots__ + if getattr(self, attr) is not None + ) + ) + def __len__(self) -> int: return len(self.write()) def __getitem__(self, item): return getattr(self, item) - - -def remove_none(obj): - if isinstance(obj, (list, tuple, set)): - return type(obj)(remove_none(x) for x in obj if x is not None) - elif isinstance(obj, dict): - return type(obj)((remove_none(k), remove_none(v)) for k, v in obj.items() if k is not None and v is not None) - else: - return obj - - -def default(o: "Object"): - try: - content = {i: getattr(o, i) for i in o.__slots__} - - return remove_none( - OrderedDict( - [("_", o.QUALNAME)] - + [i for i in content.items()] - ) - ) - except AttributeError: - if isinstance(o, datetime): - return o.strftime("%d-%b-%Y %H:%M:%S") - else: - return repr(o) diff --git a/pyrogram/client/types/inline_mode/inline_query.py b/pyrogram/client/types/inline_mode/inline_query.py index ab546b5e..4d1c9a16 100644 --- a/pyrogram/client/types/inline_mode/inline_query.py +++ b/pyrogram/client/types/inline_mode/inline_query.py @@ -53,7 +53,7 @@ class InlineQuery(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: str, from_user: User, query: str, @@ -62,7 +62,6 @@ class InlineQuery(PyrogramType, Update): ): super().__init__(client) - self._client = client self.id = id self.from_user = from_user self.query = query diff --git a/pyrogram/client/types/inline_mode/inline_query_result.py b/pyrogram/client/types/inline_mode/inline_query_result.py index c9a46ff2..4b7f7ca3 100644 --- a/pyrogram/client/types/inline_mode/inline_query_result.py +++ b/pyrogram/client/types/inline_mode/inline_query_result.py @@ -50,7 +50,7 @@ class InlineQueryResult(PyrogramType): __slots__ = ["type", "id"] def __init__(self, type: str, id: str): - super().__init__(None) + super().__init__() self.type = type self.id = id diff --git a/pyrogram/client/types/input_media/input_media.py b/pyrogram/client/types/input_media/input_media.py index 551ca639..8360862f 100644 --- a/pyrogram/client/types/input_media/input_media.py +++ b/pyrogram/client/types/input_media/input_media.py @@ -33,7 +33,7 @@ class InputMedia(PyrogramType): __slots__ = ["media", "caption", "parse_mode"] def __init__(self, media: str, caption: str, parse_mode: str): - super().__init__(None) + super().__init__() self.media = media self.caption = caption diff --git a/pyrogram/client/types/input_message_content/input_message_content.py b/pyrogram/client/types/input_message_content/input_message_content.py index 0cd264b7..50e068b7 100644 --- a/pyrogram/client/types/input_message_content/input_message_content.py +++ b/pyrogram/client/types/input_message_content/input_message_content.py @@ -34,4 +34,4 @@ class InputMessageContent(PyrogramType): __slots__ = [] def __init__(self): - super().__init__(None) + super().__init__() diff --git a/pyrogram/client/types/keyboards/callback_game.py b/pyrogram/client/types/keyboards/callback_game.py index b7397075..4fa43a30 100644 --- a/pyrogram/client/types/keyboards/callback_game.py +++ b/pyrogram/client/types/keyboards/callback_game.py @@ -28,4 +28,4 @@ class CallbackGame(PyrogramType): __slots__ = [] def __init__(self): - super().__init__(None) + super().__init__() diff --git a/pyrogram/client/types/keyboards/callback_query.py b/pyrogram/client/types/keyboards/callback_query.py index e58f77c2..822ea234 100644 --- a/pyrogram/client/types/keyboards/callback_query.py +++ b/pyrogram/client/types/keyboards/callback_query.py @@ -64,7 +64,7 @@ class CallbackQuery(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: str, from_user: User, chat_instance: str, diff --git a/pyrogram/client/types/keyboards/force_reply.py b/pyrogram/client/types/keyboards/force_reply.py index f2d337b6..5b263d03 100644 --- a/pyrogram/client/types/keyboards/force_reply.py +++ b/pyrogram/client/types/keyboards/force_reply.py @@ -42,7 +42,7 @@ class ForceReply(PyrogramType): self, selective: bool = None ): - super().__init__(None) + super().__init__() self.selective = selective diff --git a/pyrogram/client/types/keyboards/game_high_score.py b/pyrogram/client/types/keyboards/game_high_score.py index 302decec..56389b17 100644 --- a/pyrogram/client/types/keyboards/game_high_score.py +++ b/pyrogram/client/types/keyboards/game_high_score.py @@ -42,7 +42,7 @@ class GameHighScore(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, user: User, score: int, position: int = None diff --git a/pyrogram/client/types/keyboards/game_high_scores.py b/pyrogram/client/types/keyboards/game_high_scores.py index 1c2cf105..8183b9b0 100644 --- a/pyrogram/client/types/keyboards/game_high_scores.py +++ b/pyrogram/client/types/keyboards/game_high_scores.py @@ -40,7 +40,7 @@ class GameHighScores(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, total_count: int, game_high_scores: List[GameHighScore] ): diff --git a/pyrogram/client/types/keyboards/inline_keyboard_button.py b/pyrogram/client/types/keyboards/inline_keyboard_button.py index 358eae21..7e9fd458 100644 --- a/pyrogram/client/types/keyboards/inline_keyboard_button.py +++ b/pyrogram/client/types/keyboards/inline_keyboard_button.py @@ -71,7 +71,7 @@ class InlineKeyboardButton(PyrogramType): switch_inline_query_current_chat: str = None, callback_game: CallbackGame = None ): - super().__init__(None) + super().__init__() self.text = str(text) self.url = url diff --git a/pyrogram/client/types/keyboards/inline_keyboard_markup.py b/pyrogram/client/types/keyboards/inline_keyboard_markup.py index c940fa1a..c7230eaf 100644 --- a/pyrogram/client/types/keyboards/inline_keyboard_markup.py +++ b/pyrogram/client/types/keyboards/inline_keyboard_markup.py @@ -37,7 +37,7 @@ class InlineKeyboardMarkup(PyrogramType): self, inline_keyboard: List[List[InlineKeyboardButton]] ): - super().__init__(None) + super().__init__() self.inline_keyboard = inline_keyboard diff --git a/pyrogram/client/types/keyboards/keyboard_button.py b/pyrogram/client/types/keyboards/keyboard_button.py index 405e37b5..93d2e5ef 100644 --- a/pyrogram/client/types/keyboards/keyboard_button.py +++ b/pyrogram/client/types/keyboards/keyboard_button.py @@ -48,7 +48,7 @@ class KeyboardButton(PyrogramType): request_contact: bool = None, request_location: bool = None ): - super().__init__(None) + super().__init__() self.text = str(text) self.request_contact = request_contact diff --git a/pyrogram/client/types/keyboards/reply_keyboard_markup.py b/pyrogram/client/types/keyboards/reply_keyboard_markup.py index 85ab16f4..c4b37b7c 100644 --- a/pyrogram/client/types/keyboards/reply_keyboard_markup.py +++ b/pyrogram/client/types/keyboards/reply_keyboard_markup.py @@ -58,7 +58,7 @@ class ReplyKeyboardMarkup(PyrogramType): one_time_keyboard: bool = None, selective: bool = None ): - super().__init__(None) + super().__init__() self.keyboard = keyboard self.resize_keyboard = resize_keyboard diff --git a/pyrogram/client/types/keyboards/reply_keyboard_remove.py b/pyrogram/client/types/keyboards/reply_keyboard_remove.py index bb448447..9d6eb7d5 100644 --- a/pyrogram/client/types/keyboards/reply_keyboard_remove.py +++ b/pyrogram/client/types/keyboards/reply_keyboard_remove.py @@ -43,7 +43,7 @@ class ReplyKeyboardRemove(PyrogramType): self, selective: bool = None ): - super().__init__(None) + super().__init__() self.selective = selective diff --git a/pyrogram/client/types/messages_and_media/animation.py b/pyrogram/client/types/messages_and_media/animation.py index 8d889cc2..cd6e03ab 100644 --- a/pyrogram/client/types/messages_and_media/animation.py +++ b/pyrogram/client/types/messages_and_media/animation.py @@ -62,7 +62,7 @@ class Animation(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, width: int, height: int, diff --git a/pyrogram/client/types/messages_and_media/audio.py b/pyrogram/client/types/messages_and_media/audio.py index 704f4f75..76181a22 100644 --- a/pyrogram/client/types/messages_and_media/audio.py +++ b/pyrogram/client/types/messages_and_media/audio.py @@ -62,7 +62,7 @@ class Audio(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, duration: int, thumb: PhotoSize = None, diff --git a/pyrogram/client/types/messages_and_media/contact.py b/pyrogram/client/types/messages_and_media/contact.py index fb4eb3a6..9205304e 100644 --- a/pyrogram/client/types/messages_and_media/contact.py +++ b/pyrogram/client/types/messages_and_media/contact.py @@ -47,7 +47,7 @@ class Contact(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, phone_number: str, first_name: str, last_name: str = None, diff --git a/pyrogram/client/types/messages_and_media/document.py b/pyrogram/client/types/messages_and_media/document.py index 754fc5af..394d5e14 100644 --- a/pyrogram/client/types/messages_and_media/document.py +++ b/pyrogram/client/types/messages_and_media/document.py @@ -53,7 +53,7 @@ class Document(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, thumb: PhotoSize = None, file_name: str = None, diff --git a/pyrogram/client/types/messages_and_media/game.py b/pyrogram/client/types/messages_and_media/game.py index b4c96a11..1377173a 100644 --- a/pyrogram/client/types/messages_and_media/game.py +++ b/pyrogram/client/types/messages_and_media/game.py @@ -53,7 +53,7 @@ class Game(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: int, title: str, short_name: str, diff --git a/pyrogram/client/types/messages_and_media/location.py b/pyrogram/client/types/messages_and_media/location.py index c3d8f974..55def7a0 100644 --- a/pyrogram/client/types/messages_and_media/location.py +++ b/pyrogram/client/types/messages_and_media/location.py @@ -38,7 +38,7 @@ class Location(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, longitude: float, latitude: float ): diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 28a5d0ea..d37028b5 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -282,7 +282,7 @@ class Message(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, message_id: int, date: int = None, chat: Chat = None, @@ -2852,7 +2852,7 @@ class Message(PyrogramType, Update): block: bool = True, progress: callable = None, progress_args: tuple = () - ) -> "Message": + ) -> str: """Bound method *download* of :obj:`Message`. Use as a shortcut for: diff --git a/pyrogram/client/types/messages_and_media/message_entity.py b/pyrogram/client/types/messages_and_media/message_entity.py index 768dee1e..e369e74e 100644 --- a/pyrogram/client/types/messages_and_media/message_entity.py +++ b/pyrogram/client/types/messages_and_media/message_entity.py @@ -68,7 +68,7 @@ class MessageEntity(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, type: str, offset: int, length: int, diff --git a/pyrogram/client/types/messages_and_media/messages.py b/pyrogram/client/types/messages_and_media/messages.py index 4f930a22..379830be 100644 --- a/pyrogram/client/types/messages_and_media/messages.py +++ b/pyrogram/client/types/messages_and_media/messages.py @@ -42,7 +42,7 @@ class Messages(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, total_count: int, messages: List[Message] ): diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index c2d0eb1f..8d60d59a 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -46,7 +46,7 @@ class Photo(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: str, date: int, sizes: List[PhotoSize] diff --git a/pyrogram/client/types/messages_and_media/photo_size.py b/pyrogram/client/types/messages_and_media/photo_size.py index c76ef914..9f64ae6a 100644 --- a/pyrogram/client/types/messages_and_media/photo_size.py +++ b/pyrogram/client/types/messages_and_media/photo_size.py @@ -47,7 +47,7 @@ class PhotoSize(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, width: int, height: int, diff --git a/pyrogram/client/types/messages_and_media/poll.py b/pyrogram/client/types/messages_and_media/poll.py index 8aa32137..e6c97bfb 100644 --- a/pyrogram/client/types/messages_and_media/poll.py +++ b/pyrogram/client/types/messages_and_media/poll.py @@ -53,7 +53,7 @@ class Poll(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: str, question: str, options: List[PollOption], diff --git a/pyrogram/client/types/messages_and_media/poll_option.py b/pyrogram/client/types/messages_and_media/poll_option.py index e594e3ca..e7eb1f5f 100644 --- a/pyrogram/client/types/messages_and_media/poll_option.py +++ b/pyrogram/client/types/messages_and_media/poll_option.py @@ -30,14 +30,17 @@ class PollOption(PyrogramType): voter_count (``int``): Number of users that voted for this option. Equals to 0 until you vote. + + data (``bytes``): + The data this poll option is holding. """ - __slots__ = ["text", "voter_count", "_data"] + __slots__ = ["text", "voter_count", "data"] def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, text: str, voter_count: int, data: bytes @@ -46,4 +49,4 @@ class PollOption(PyrogramType): self.text = text self.voter_count = voter_count - self._data = data # Hidden + self.data = data diff --git a/pyrogram/client/types/messages_and_media/sticker.py b/pyrogram/client/types/messages_and_media/sticker.py index 0a3a42d1..edeee37e 100644 --- a/pyrogram/client/types/messages_and_media/sticker.py +++ b/pyrogram/client/types/messages_and_media/sticker.py @@ -71,7 +71,7 @@ class Sticker(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, width: int, height: int, diff --git a/pyrogram/client/types/messages_and_media/user_profile_photos.py b/pyrogram/client/types/messages_and_media/user_profile_photos.py index c74a371b..628831d5 100644 --- a/pyrogram/client/types/messages_and_media/user_profile_photos.py +++ b/pyrogram/client/types/messages_and_media/user_profile_photos.py @@ -39,7 +39,7 @@ class UserProfilePhotos(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, total_count: int, photos: List[Photo] ): diff --git a/pyrogram/client/types/messages_and_media/venue.py b/pyrogram/client/types/messages_and_media/venue.py index cac84e57..e54a812e 100644 --- a/pyrogram/client/types/messages_and_media/venue.py +++ b/pyrogram/client/types/messages_and_media/venue.py @@ -49,7 +49,7 @@ class Venue(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, location: Location, title: str, address: str, diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py index 13980270..529fc5ef 100644 --- a/pyrogram/client/types/messages_and_media/video.py +++ b/pyrogram/client/types/messages_and_media/video.py @@ -68,7 +68,7 @@ class Video(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, width: int, height: int, diff --git a/pyrogram/client/types/messages_and_media/video_note.py b/pyrogram/client/types/messages_and_media/video_note.py index 5ebc8774..133ccae0 100644 --- a/pyrogram/client/types/messages_and_media/video_note.py +++ b/pyrogram/client/types/messages_and_media/video_note.py @@ -56,7 +56,7 @@ class VideoNote(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, length: int, duration: int, diff --git a/pyrogram/client/types/messages_and_media/voice.py b/pyrogram/client/types/messages_and_media/voice.py index 88154e2f..3e08d57a 100644 --- a/pyrogram/client/types/messages_and_media/voice.py +++ b/pyrogram/client/types/messages_and_media/voice.py @@ -52,7 +52,7 @@ class Voice(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, file_id: str, duration: int, waveform: bytes = None, diff --git a/pyrogram/client/types/pyrogram_type.py b/pyrogram/client/types/pyrogram_type.py index 5f757d43..ed50efbc 100644 --- a/pyrogram/client/types/pyrogram_type.py +++ b/pyrogram/client/types/pyrogram_type.py @@ -25,34 +25,45 @@ import pyrogram class PyrogramType: __slots__ = ["_client"] - def __init__(self, client: "pyrogram.client.ext.BaseClient"): + def __init__(self, client: "pyrogram.BaseClient" = None): self._client = client - def __str__(self): + if self._client is None: + del self._client + + def __eq__(self, other: "PyrogramType") -> bool: + for attr in self.__slots__: + try: + if getattr(self, attr) != getattr(other, attr): + return False + except AttributeError: + return False + + return True + + def __str__(self) -> str: + def default(obj: PyrogramType): + try: + return OrderedDict( + [("_", "pyrogram." + obj.__class__.__name__)] + + [(attr, getattr(obj, attr)) + for attr in obj.__slots__ + if getattr(obj, attr) is not None] + ) + except AttributeError: + return repr(obj) + return dumps(self, indent=4, default=default, ensure_ascii=False) + def __repr__(self) -> str: + return "pyrogram.{}({})".format( + self.__class__.__name__, + ", ".join( + "{}={}".format(attr, repr(getattr(self, attr))) + for attr in self.__slots__ + if getattr(self, attr) is not None + ) + ) + def __getitem__(self, item): return getattr(self, item) - - -def remove_none(obj): - if isinstance(obj, (list, tuple, set)): - return type(obj)(remove_none(x) for x in obj if x is not None) - elif isinstance(obj, dict): - return type(obj)((remove_none(k), remove_none(v)) for k, v in obj.items() if k is not None and v is not None) - else: - return obj - - -def default(o: PyrogramType): - try: - content = {i: getattr(o, i) for i in o.__slots__} - - return remove_none( - OrderedDict( - [("_", "pyrogram." + o.__class__.__name__)] - + [i for i in content.items() if not i[0].startswith("_")] - ) - ) - except AttributeError: - return repr(o) diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index 3b5f242b..8793942c 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -89,7 +89,7 @@ class Chat(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: int, type: str, title: str = None, diff --git a/pyrogram/client/types/user_and_chats/chat_member.py b/pyrogram/client/types/user_and_chats/chat_member.py index 9de9986a..536f9526 100644 --- a/pyrogram/client/types/user_and_chats/chat_member.py +++ b/pyrogram/client/types/user_and_chats/chat_member.py @@ -59,7 +59,7 @@ class ChatMember(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, user: "pyrogram.User", status: str, date: int = None, diff --git a/pyrogram/client/types/user_and_chats/chat_members.py b/pyrogram/client/types/user_and_chats/chat_members.py index 8f98277c..f57b8b46 100644 --- a/pyrogram/client/types/user_and_chats/chat_members.py +++ b/pyrogram/client/types/user_and_chats/chat_members.py @@ -40,7 +40,7 @@ class ChatMembers(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, total_count: int, chat_members: List[ChatMember] ): diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py index 3f1f7cc6..37fde9fd 100644 --- a/pyrogram/client/types/user_and_chats/chat_photo.py +++ b/pyrogram/client/types/user_and_chats/chat_photo.py @@ -40,7 +40,7 @@ class ChatPhoto(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, small_file_id: str, big_file_id: str ): diff --git a/pyrogram/client/types/user_and_chats/chat_preview.py b/pyrogram/client/types/user_and_chats/chat_preview.py index 880dcc8e..0366d04f 100644 --- a/pyrogram/client/types/user_and_chats/chat_preview.py +++ b/pyrogram/client/types/user_and_chats/chat_preview.py @@ -50,7 +50,7 @@ class ChatPreview(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, title: str, photo: ChatPhoto, type: str, diff --git a/pyrogram/client/types/user_and_chats/dialog.py b/pyrogram/client/types/user_and_chats/dialog.py index 3dc09dbc..fc691ab6 100644 --- a/pyrogram/client/types/user_and_chats/dialog.py +++ b/pyrogram/client/types/user_and_chats/dialog.py @@ -51,7 +51,7 @@ class Dialog(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, chat: Chat, top_message: "pyrogram.Message", unread_messages_count: int, diff --git a/pyrogram/client/types/user_and_chats/dialogs.py b/pyrogram/client/types/user_and_chats/dialogs.py index 43b9f667..0d6a0935 100644 --- a/pyrogram/client/types/user_and_chats/dialogs.py +++ b/pyrogram/client/types/user_and_chats/dialogs.py @@ -41,7 +41,7 @@ class Dialogs(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, total_count: int, dialogs: List[Dialog] ): diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index c5a0976c..455b4a4d 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -78,7 +78,7 @@ class User(PyrogramType): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, id: int, is_self: bool, is_contact: bool, diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py index f91c2924..e6f5b134 100644 --- a/pyrogram/client/types/user_and_chats/user_status.py +++ b/pyrogram/client/types/user_and_chats/user_status.py @@ -70,7 +70,7 @@ class UserStatus(PyrogramType, Update): def __init__( self, *, - client: "pyrogram.client.ext.BaseClient", + client: "pyrogram.BaseClient" = None, user_id: int, online: bool = None, offline: bool = None,