diff --git a/pyrogram/client/types/bots/callback_game.py b/pyrogram/client/types/bots/callback_game.py index be026360..fc2d9884 100644 --- a/pyrogram/client/types/bots/callback_game.py +++ b/pyrogram/client/types/bots/callback_game.py @@ -25,5 +25,7 @@ class CallbackGame(PyrogramType): Use BotFather to set up your game. """ + __slots__ = [] + def __init__(self): super().__init__(None) diff --git a/pyrogram/client/types/bots/callback_query.py b/pyrogram/client/types/bots/callback_query.py index c2558844..a7a9ad53 100644 --- a/pyrogram/client/types/bots/callback_query.py +++ b/pyrogram/client/types/bots/callback_query.py @@ -58,16 +58,20 @@ class CallbackQuery(PyrogramType, Update): """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: str, - from_user: User, - chat_instance: str, - message: "pyrogram.Message" = None, - inline_message_id: str = None, - data: bytes = None, - game_short_name: str = None): + __slots__ = ["id", "from_user", "chat_instance", "message", "inline_message_id", "data", "game_short_name"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: str, + from_user: User, + chat_instance: str, + message: "pyrogram.Message" = None, + inline_message_id: str = None, + data: bytes = None, + game_short_name: str = None + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/bots/force_reply.py b/pyrogram/client/types/bots/force_reply.py index 2e5c2f42..7838ee88 100644 --- a/pyrogram/client/types/bots/force_reply.py +++ b/pyrogram/client/types/bots/force_reply.py @@ -33,8 +33,12 @@ class ForceReply(PyrogramType): 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. """ - def __init__(self, - selective: bool = None): + __slots__ = ["selective"] + + def __init__( + self, + selective: bool = None + ): super().__init__(None) self.selective = selective diff --git a/pyrogram/client/types/bots/game_high_score.py b/pyrogram/client/types/bots/game_high_score.py index 0541c18c..4fc3c6f8 100644 --- a/pyrogram/client/types/bots/game_high_score.py +++ b/pyrogram/client/types/bots/game_high_score.py @@ -37,12 +37,16 @@ class GameHighScore(PyrogramType): Position in high score table for the game. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - user: User, - score: int, - position: int = None): + __slots__ = ["user", "score", "position"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + user: User, + score: int, + position: int = None + ): super().__init__(client) self.user = user diff --git a/pyrogram/client/types/bots/game_high_scores.py b/pyrogram/client/types/bots/game_high_scores.py index 1717effa..25e4af5d 100644 --- a/pyrogram/client/types/bots/game_high_scores.py +++ b/pyrogram/client/types/bots/game_high_scores.py @@ -35,11 +35,15 @@ class GameHighScores(PyrogramType): Game scores. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - total_count: int, - game_high_scores: List[GameHighScore]): + __slots__ = ["total_count", "game_high_scores"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + total_count: int, + game_high_scores: List[GameHighScore] + ): super().__init__(client) self.total_count = total_count diff --git a/pyrogram/client/types/bots/inline_keyboard_button.py b/pyrogram/client/types/bots/inline_keyboard_button.py index cc829cb1..505b7c87 100644 --- a/pyrogram/client/types/bots/inline_keyboard_button.py +++ b/pyrogram/client/types/bots/inline_keyboard_button.py @@ -54,13 +54,19 @@ class InlineKeyboardButton(PyrogramType): # TODO: Add callback_game and pay fields - def __init__(self, - text: str, - callback_data: bytes = None, - url: str = None, - switch_inline_query: str = None, - switch_inline_query_current_chat: str = None, - callback_game: CallbackGame = None): + __slots__ = [ + "text", "url", "callback_data", "switch_inline_query", "switch_inline_query_current_chat", "callback_game" + ] + + def __init__( + self, + text: str, + callback_data: bytes = None, + url: str = None, + switch_inline_query: str = None, + switch_inline_query_current_chat: str = None, + callback_game: CallbackGame = None + ): super().__init__(None) self.text = str(text) diff --git a/pyrogram/client/types/bots/inline_keyboard_markup.py b/pyrogram/client/types/bots/inline_keyboard_markup.py index f18bd605..cb5327b1 100644 --- a/pyrogram/client/types/bots/inline_keyboard_markup.py +++ b/pyrogram/client/types/bots/inline_keyboard_markup.py @@ -31,8 +31,12 @@ class InlineKeyboardMarkup(PyrogramType): List of button rows, each represented by a List of InlineKeyboardButton objects. """ - def __init__(self, - inline_keyboard: List[List[InlineKeyboardButton]]): + __slots__ = ["inline_keyboard"] + + def __init__( + self, + inline_keyboard: List[List[InlineKeyboardButton]] + ): super().__init__(None) self.inline_keyboard = inline_keyboard diff --git a/pyrogram/client/types/bots/keyboard_button.py b/pyrogram/client/types/bots/keyboard_button.py index 3c7c2bd6..dc4ed1e7 100644 --- a/pyrogram/client/types/bots/keyboard_button.py +++ b/pyrogram/client/types/bots/keyboard_button.py @@ -40,10 +40,14 @@ class KeyboardButton(PyrogramType): Available in private chats only. """ - def __init__(self, - text: str, - request_contact: bool = None, - request_location: bool = None): + __slots__ = ["text", "request_contact", "request_location"] + + def __init__( + self, + text: str, + request_contact: bool = None, + request_location: bool = None + ): super().__init__(None) self.text = str(text) diff --git a/pyrogram/client/types/bots/reply_keyboard_markup.py b/pyrogram/client/types/bots/reply_keyboard_markup.py index afae236d..229899d0 100644 --- a/pyrogram/client/types/bots/reply_keyboard_markup.py +++ b/pyrogram/client/types/bots/reply_keyboard_markup.py @@ -49,11 +49,15 @@ class ReplyKeyboardMarkup(PyrogramType): select the new language. Other users in the group don't see the keyboard. """ - def __init__(self, - keyboard: List[List[Union[KeyboardButton, str]]], - resize_keyboard: bool = None, - one_time_keyboard: bool = None, - selective: bool = None): + __slots__ = ["keyboard", "resize_keyboard", "one_time_keyboard", "selective"] + + def __init__( + self, + keyboard: List[List[Union[KeyboardButton, str]]], + resize_keyboard: bool = None, + one_time_keyboard: bool = None, + selective: bool = None + ): super().__init__(None) self.keyboard = keyboard diff --git a/pyrogram/client/types/bots/reply_keyboard_remove.py b/pyrogram/client/types/bots/reply_keyboard_remove.py index 5b67fbb4..2fb5fe19 100644 --- a/pyrogram/client/types/bots/reply_keyboard_remove.py +++ b/pyrogram/client/types/bots/reply_keyboard_remove.py @@ -35,8 +35,12 @@ class ReplyKeyboardRemove(PyrogramType): keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. """ - def __init__(self, - selective: bool = None): + __slots__ = ["selective"] + + def __init__( + self, + selective: bool = None + ): super().__init__(None) self.selective = selective diff --git a/pyrogram/client/types/input_media/input_media.py b/pyrogram/client/types/input_media/input_media.py index f55d8aa0..677d4918 100644 --- a/pyrogram/client/types/input_media/input_media.py +++ b/pyrogram/client/types/input_media/input_media.py @@ -18,10 +18,14 @@ class InputMedia: - def __init__(self, - media: str, - caption: str, - parse_mode: str): + __slots__ = ["media", "caption", "parse_mode"] + + def __init__( + self, + media: str, + caption: str, + parse_mode: str + ): self.media = media self.caption = caption self.parse_mode = parse_mode diff --git a/pyrogram/client/types/input_media/input_media_animation.py b/pyrogram/client/types/input_media/input_media_animation.py index af0c2b2a..20debb19 100644 --- a/pyrogram/client/types/input_media/input_media_animation.py +++ b/pyrogram/client/types/input_media/input_media_animation.py @@ -52,14 +52,18 @@ class InputMediaAnimation(InputMedia): Animation duration. """ - def __init__(self, - media: str, - thumb: str = None, - caption: str = "", - parse_mode: str = "", - width: int = 0, - height: int = 0, - duration: int = 0): + __slots__ = ["thumb", "width", "height", "duration"] + + def __init__( + self, + media: str, + thumb: str = None, + caption: str = "", + parse_mode: str = "", + width: int = 0, + height: int = 0, + duration: int = 0 + ): super().__init__(media, caption, parse_mode) self.thumb = thumb diff --git a/pyrogram/client/types/input_media/input_media_audio.py b/pyrogram/client/types/input_media/input_media_audio.py index a2dc18db..2709a409 100644 --- a/pyrogram/client/types/input_media/input_media_audio.py +++ b/pyrogram/client/types/input_media/input_media_audio.py @@ -53,14 +53,18 @@ class InputMediaAudio(InputMedia): Title of the audio """ - def __init__(self, - media: str, - thumb: str = None, - caption: str = "", - parse_mode: str = "", - duration: int = 0, - performer: int = "", - title: str = ""): + __slots__ = ["thumb", "duration", "performer", "title"] + + def __init__( + self, + media: str, + thumb: str = None, + caption: str = "", + parse_mode: str = "", + duration: int = 0, + performer: int = "", + title: str = "" + ): super().__init__(media, caption, parse_mode) self.thumb = thumb diff --git a/pyrogram/client/types/input_media/input_media_document.py b/pyrogram/client/types/input_media/input_media_document.py index 25e17d0f..2c0c628d 100644 --- a/pyrogram/client/types/input_media/input_media_document.py +++ b/pyrogram/client/types/input_media/input_media_document.py @@ -43,11 +43,15 @@ class InputMediaDocument(InputMedia): Defaults to Markdown. """ - def __init__(self, - media: str, - thumb: str = None, - caption: str = "", - parse_mode: str = ""): + __slots__ = ["thumb"] + + def __init__( + self, + media: str, + thumb: str = None, + caption: str = "", + parse_mode: str = "" + ): super().__init__(media, caption, parse_mode) self.thumb = thumb diff --git a/pyrogram/client/types/input_media/input_media_photo.py b/pyrogram/client/types/input_media/input_media_photo.py index 5917fbf0..5618b843 100644 --- a/pyrogram/client/types/input_media/input_media_photo.py +++ b/pyrogram/client/types/input_media/input_media_photo.py @@ -39,8 +39,12 @@ class InputMediaPhoto(InputMedia): Defaults to Markdown. """ - def __init__(self, - media: str, - caption: str = "", - parse_mode: str = ""): + __slots__ = [] + + def __init__( + self, + media: str, + caption: str = "", + parse_mode: str = "" + ): super().__init__(media, caption, parse_mode) diff --git a/pyrogram/client/types/input_media/input_media_video.py b/pyrogram/client/types/input_media/input_media_video.py index 6fa7936e..b55a9438 100644 --- a/pyrogram/client/types/input_media/input_media_video.py +++ b/pyrogram/client/types/input_media/input_media_video.py @@ -57,15 +57,19 @@ class InputMediaVideo(InputMedia): Pass True, if the uploaded video is suitable for streaming. """ - def __init__(self, - media: str, - thumb: str = None, - caption: str = "", - parse_mode: str = "", - width: int = 0, - height: int = 0, - duration: int = 0, - supports_streaming: bool = True): + __slots__ = ["thumb", "width", "height", "duration", "supports_streaming"] + + def __init__( + self, + media: str, + thumb: str = None, + caption: str = "", + parse_mode: str = "", + width: int = 0, + height: int = 0, + duration: int = 0, + supports_streaming: bool = True + ): super().__init__(media, caption, parse_mode) self.thumb = thumb diff --git a/pyrogram/client/types/input_media/input_phone_contact.py b/pyrogram/client/types/input_media/input_phone_contact.py index 1a89759a..340b335f 100644 --- a/pyrogram/client/types/input_media/input_phone_contact.py +++ b/pyrogram/client/types/input_media/input_phone_contact.py @@ -35,10 +35,14 @@ class InputPhoneContact: Contact's last name """ - def __init__(self, - phone: str, - first_name: str, - last_name: str = ""): + __slots__ = [] + + def __init__( + self, + phone: str, + first_name: str, + last_name: str = "" + ): pass def __new__(cls, diff --git a/pyrogram/client/types/messages_and_media/animation.py b/pyrogram/client/types/messages_and_media/animation.py index 9f3ba886..978c88c9 100644 --- a/pyrogram/client/types/messages_and_media/animation.py +++ b/pyrogram/client/types/messages_and_media/animation.py @@ -57,18 +57,22 @@ class Animation(PyrogramType): Date the animation was sent in Unix time. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - width: int, - height: int, - duration: int, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None): + __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "duration"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + width: int, + height: int, + duration: int, + thumb: PhotoSize = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/audio.py b/pyrogram/client/types/messages_and_media/audio.py index 9c5698f1..334e022e 100644 --- a/pyrogram/client/types/messages_and_media/audio.py +++ b/pyrogram/client/types/messages_and_media/audio.py @@ -57,18 +57,22 @@ class Audio(PyrogramType): Title of the audio as defined by sender or by audio tags. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - duration: int, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - performer: str = None, - title: str = None): + __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "duration", "performer", "title"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + duration: int, + thumb: PhotoSize = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + performer: str = None, + title: str = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/contact.py b/pyrogram/client/types/messages_and_media/contact.py index 51acb59f..0a897c05 100644 --- a/pyrogram/client/types/messages_and_media/contact.py +++ b/pyrogram/client/types/messages_and_media/contact.py @@ -42,14 +42,18 @@ class Contact(PyrogramType): Additional data about the contact in the form of a vCard. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - phone_number: str, - first_name: str, - last_name: str = None, - user_id: int = None, - vcard: str = None): + __slots__ = ["phone_number", "first_name", "last_name", "user_id", "vcard"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + phone_number: str, + first_name: str, + last_name: str = None, + user_id: int = None, + vcard: str = None + ): super().__init__(client) self.phone_number = phone_number diff --git a/pyrogram/client/types/messages_and_media/document.py b/pyrogram/client/types/messages_and_media/document.py index 5cd01a92..b3f5b586 100644 --- a/pyrogram/client/types/messages_and_media/document.py +++ b/pyrogram/client/types/messages_and_media/document.py @@ -48,15 +48,19 @@ class Document(PyrogramType): Date the document was sent in Unix time. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None): + __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + thumb: PhotoSize = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/game.py b/pyrogram/client/types/messages_and_media/game.py index 01af7226..ddfa84af 100644 --- a/pyrogram/client/types/messages_and_media/game.py +++ b/pyrogram/client/types/messages_and_media/game.py @@ -48,15 +48,19 @@ class Game(PyrogramType): Upload via BotFather. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: int, - title: str, - short_name: str, - description: str, - photo: Photo, - animation: Animation = None): + __slots__ = ["id", "title", "short_name", "description", "photo", "animation"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: int, + title: str, + short_name: str, + description: str, + photo: Photo, + animation: Animation = None + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/messages_and_media/location.py b/pyrogram/client/types/messages_and_media/location.py index 64acdbf5..0d2e6c43 100644 --- a/pyrogram/client/types/messages_and_media/location.py +++ b/pyrogram/client/types/messages_and_media/location.py @@ -33,11 +33,15 @@ class Location(PyrogramType): Latitude as defined by sender. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - longitude: float, - latitude: float): + __slots__ = ["longitude", "latitude"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + longitude: float, + latitude: float + ): super().__init__(client) self.longitude = longitude diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index badd3689..405c26d9 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -234,65 +234,80 @@ class Message(PyrogramType, Update): # TODO: Add game missing field. Also invoice, successful_payment, connected_website - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - message_id: int, - date: int = None, - chat: Chat = None, - from_user: User = None, - forward_from: User = None, - forward_from_chat: 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: bool = None, - media: bool = None, - edit_date: int = None, - media_group_id: str = None, - author_signature: str = None, - text: str = None, - entities: List["pyrogram.MessageEntity"] = None, - caption_entities: List["pyrogram.MessageEntity"] = None, - audio: "pyrogram.Audio" = None, - document: "pyrogram.Document" = None, - photo: "pyrogram.Photo" = None, - sticker: "pyrogram.Sticker" = None, - animation: "pyrogram.Animation" = None, - game: "pyrogram.Game" = None, - video: "pyrogram.Video" = None, - voice: "pyrogram.Voice" = None, - video_note: "pyrogram.VideoNote" = None, - caption: str = None, - contact: "pyrogram.Contact" = None, - location: "pyrogram.Location" = None, - venue: "pyrogram.Venue" = None, - web_page: bool = None, - poll: "pyrogram.Poll" = None, - new_chat_members: List[User] = None, - left_chat_member: User = None, - new_chat_title: str = None, - new_chat_photo: "pyrogram.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: User = None, - outgoing: bool = None, - matches: List[Match] = None, - command: List[str] = None, - reply_markup: Union["pyrogram.InlineKeyboardMarkup", - "pyrogram.ReplyKeyboardMarkup", - "pyrogram.ReplyKeyboardRemove", - "pyrogram.ForceReply"] = None): + __slots__ = [ + "message_id", "date", "chat", "from_user", "forward_from", "forward_from_chat", "forward_from_message_id", + "forward_signature", "forward_date", "reply_to_message", "mentioned", "empty", "service", "media", "edit_date", + "media_group_id", "author_signature", "text", "entities", "caption_entities", "audio", "document", "photo", + "sticker", "animation", "game", "video", "voice", "video_note", "caption", "contact", "location", "venue", + "web_page", "poll", "new_chat_members", "left_chat_member", "new_chat_title", "new_chat_photo", + "delete_chat_photo", "group_chat_created", "supergroup_chat_created", "channel_chat_created", + "migrate_to_chat_id", "migrate_from_chat_id", "pinned_message", "game_high_score", "views", "via_bot", + "outgoing", "matches", "command", "reply_markup" + ] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + message_id: int, + date: int = None, + chat: Chat = None, + from_user: User = None, + forward_from: User = None, + forward_from_chat: 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: bool = None, + media: bool = None, + edit_date: int = None, + media_group_id: str = None, + author_signature: str = None, + text: str = None, + entities: List["pyrogram.MessageEntity"] = None, + caption_entities: List["pyrogram.MessageEntity"] = None, + audio: "pyrogram.Audio" = None, + document: "pyrogram.Document" = None, + photo: "pyrogram.Photo" = None, + sticker: "pyrogram.Sticker" = None, + animation: "pyrogram.Animation" = None, + game: "pyrogram.Game" = None, + video: "pyrogram.Video" = None, + voice: "pyrogram.Voice" = None, + video_note: "pyrogram.VideoNote" = None, + caption: str = None, + contact: "pyrogram.Contact" = None, + location: "pyrogram.Location" = None, + venue: "pyrogram.Venue" = None, + web_page: bool = None, + poll: "pyrogram.Poll" = None, + new_chat_members: List[User] = None, + left_chat_member: User = None, + new_chat_title: str = None, + new_chat_photo: "pyrogram.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: User = None, + outgoing: bool = None, + matches: List[Match] = None, + command: List[str] = None, + reply_markup: Union[ + "pyrogram.InlineKeyboardMarkup", + "pyrogram.ReplyKeyboardMarkup", + "pyrogram.ReplyKeyboardRemove", + "pyrogram.ForceReply" + ] = None + ): super().__init__(client) self.message_id = message_id diff --git a/pyrogram/client/types/messages_and_media/message_entity.py b/pyrogram/client/types/messages_and_media/message_entity.py index 88beeb2f..fa59a5bc 100644 --- a/pyrogram/client/types/messages_and_media/message_entity.py +++ b/pyrogram/client/types/messages_and_media/message_entity.py @@ -47,6 +47,8 @@ class MessageEntity(PyrogramType): For "text_mention" only, the mentioned user. """ + __slots__ = ["type", "offset", "length", "url", "user"] + ENTITIES = { types.MessageEntityMention.ID: "mention", types.MessageEntityHashtag.ID: "hashtag", @@ -63,14 +65,16 @@ class MessageEntity(PyrogramType): types.MessageEntityPhone.ID: "phone_number" } - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - type: str, - offset: int, - length: int, - url: str = None, - user: User = None): + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + type: str, + offset: int, + length: int, + url: str = None, + user: User = None + ): super().__init__(client) self.type = type diff --git a/pyrogram/client/types/messages_and_media/messages.py b/pyrogram/client/types/messages_and_media/messages.py index d89f0bad..4a203a4e 100644 --- a/pyrogram/client/types/messages_and_media/messages.py +++ b/pyrogram/client/types/messages_and_media/messages.py @@ -37,11 +37,15 @@ class Messages(PyrogramType, Update): Requested messages. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - total_count: int, - messages: List[Message]): + __slots__ = ["total_count", "messages"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + total_count: int, + messages: List[Message] + ): super().__init__(client) self.total_count = total_count diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index aa2b3a26..12be919c 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -41,12 +41,16 @@ class Photo(PyrogramType): Available sizes of this photo. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: str, - date: int, - sizes: List[PhotoSize]): + __slots__ = ["id", "date", "sizes"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: str, + date: int, + sizes: List[PhotoSize] + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/messages_and_media/photo_size.py b/pyrogram/client/types/messages_and_media/photo_size.py index 116b564c..03569062 100644 --- a/pyrogram/client/types/messages_and_media/photo_size.py +++ b/pyrogram/client/types/messages_and_media/photo_size.py @@ -42,13 +42,17 @@ class PhotoSize(PyrogramType): File size. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - width: int, - height: int, - file_size: int): + __slots__ = ["file_id", "width", "height", "file_size"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + width: int, + height: int, + file_size: int + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/poll.py b/pyrogram/client/types/messages_and_media/poll.py index 72735c28..fa6372d9 100644 --- a/pyrogram/client/types/messages_and_media/poll.py +++ b/pyrogram/client/types/messages_and_media/poll.py @@ -47,15 +47,19 @@ class Poll(PyrogramType): The index of your chosen option (in case you voted already), None otherwise. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: int, - closed: bool, - question: str, - options: List[PollOption], - total_voters: int, - option_chosen: int = None): + __slots__ = ["id", "closed", "question", "options", "total_voters", "option_chosen"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: int, + closed: bool, + question: str, + options: List[PollOption], + total_voters: int, + option_chosen: int = None + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/messages_and_media/poll_option.py b/pyrogram/client/types/messages_and_media/poll_option.py index 227fe74f..1c2d6f1b 100644 --- a/pyrogram/client/types/messages_and_media/poll_option.py +++ b/pyrogram/client/types/messages_and_media/poll_option.py @@ -34,12 +34,16 @@ class PollOption(PyrogramType): Unique data that identifies this option among all the other options in a poll. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - text: str, - voters: int, - data: bytes): + __slots__ = ["text", "voters", "data"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + text: str, + voters: int, + data: bytes + ): super().__init__(client) self.text = text diff --git a/pyrogram/client/types/messages_and_media/sticker.py b/pyrogram/client/types/messages_and_media/sticker.py index a1ebbe32..70322577 100644 --- a/pyrogram/client/types/messages_and_media/sticker.py +++ b/pyrogram/client/types/messages_and_media/sticker.py @@ -64,19 +64,25 @@ class Sticker(PyrogramType): # TODO: Add mask position - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - width: int, - height: int, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None, - emoji: str = None, - set_name: str = None): + __slots__ = [ + "file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "emoji", "set_name" + ] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + width: int, + height: int, + thumb: PhotoSize = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None, + emoji: str = None, + set_name: str = None + ): super().__init__(client) self.file_id = file_id 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 8f8525cc..770b0ec8 100644 --- a/pyrogram/client/types/messages_and_media/user_profile_photos.py +++ b/pyrogram/client/types/messages_and_media/user_profile_photos.py @@ -34,11 +34,15 @@ class UserProfilePhotos(PyrogramType): Requested profile pictures. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - total_count: int, - photos: List[Photo]): + __slots__ = ["total_count", "photos"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + total_count: int, + photos: List[Photo] + ): super().__init__(client) self.total_count = total_count diff --git a/pyrogram/client/types/messages_and_media/venue.py b/pyrogram/client/types/messages_and_media/venue.py index 91b3455a..5dd81093 100644 --- a/pyrogram/client/types/messages_and_media/venue.py +++ b/pyrogram/client/types/messages_and_media/venue.py @@ -44,14 +44,18 @@ class Venue(PyrogramType): """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - location: Location, - title: str, - address: str, - foursquare_id: str = None, - foursquare_type: str = None): + __slots__ = ["location", "title", "address", "foursquare_id", "foursquare_type"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + location: Location, + title: str, + address: str, + foursquare_id: str = None, + foursquare_type: str = None + ): super().__init__(client) self.location = location diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py index 2ec9a947..39ec1455 100644 --- a/pyrogram/client/types/messages_and_media/video.py +++ b/pyrogram/client/types/messages_and_media/video.py @@ -57,18 +57,22 @@ class Video(PyrogramType): Date the video was sent in Unix time. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - width: int, - height: int, - duration: int, - thumb: PhotoSize = None, - file_name: str = None, - mime_type: str = None, - file_size: int = None, - date: int = None): + __slots__ = ["file_id", "thumb", "file_name", "mime_type", "file_size", "date", "width", "height", "duration"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + width: int, + height: int, + duration: int, + thumb: PhotoSize = None, + file_name: str = None, + mime_type: str = None, + file_size: int = None, + date: int = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/video_note.py b/pyrogram/client/types/messages_and_media/video_note.py index 73bb85dc..afa4ad46 100644 --- a/pyrogram/client/types/messages_and_media/video_note.py +++ b/pyrogram/client/types/messages_and_media/video_note.py @@ -51,16 +51,20 @@ class VideoNote(PyrogramType): Date the video note was sent in Unix time. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - length: int, - duration: int, - thumb: PhotoSize = None, - mime_type: str = None, - file_size: int = None, - date: int = None): + __slots__ = ["file_id", "thumb", "mime_type", "file_size", "date", "length", "duration"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + length: int, + duration: int, + thumb: PhotoSize = None, + mime_type: str = None, + file_size: int = None, + date: int = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/messages_and_media/voice.py b/pyrogram/client/types/messages_and_media/voice.py index e6bba45b..d5028cd3 100644 --- a/pyrogram/client/types/messages_and_media/voice.py +++ b/pyrogram/client/types/messages_and_media/voice.py @@ -47,15 +47,19 @@ class Voice(PyrogramType): Date the voice was sent in Unix time. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - file_id: str, - duration: int, - waveform: bytes = None, - mime_type: str = None, - file_size: int = None, - date: int = None): + __slots__ = ["file_id", "duration", "waveform", "mime_type", "file_size", "date"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + file_id: str, + duration: int, + waveform: bytes = None, + mime_type: str = None, + file_size: int = None, + date: int = None + ): super().__init__(client) self.file_id = file_id diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index db15db58..81067821 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -80,24 +80,32 @@ class Chat(PyrogramType): Information about the chat default permissions. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: int, - type: str, - title: str = None, - username: str = None, - first_name: str = None, - last_name: str = None, - photo: ChatPhoto = None, - description: str = None, - invite_link: str = None, - pinned_message=None, - sticker_set_name: str = None, - can_set_sticker_set: bool = None, - members_count: int = None, - restriction_reason: str = None, - permissions: "pyrogram.ChatPermissions" = None): + __slots__ = [ + "id", "type", "title", "username", "first_name", "last_name", "photo", "description", "invite_link", + "pinned_message", "sticker_set_name", "can_set_sticker_set", "members_count", "restriction_reason", + "permissions" + ] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: int, + type: str, + title: str = None, + username: str = None, + first_name: str = None, + last_name: str = None, + photo: ChatPhoto = None, + description: str = None, + invite_link: str = None, + pinned_message=None, + sticker_set_name: str = None, + can_set_sticker_set: bool = None, + members_count: int = None, + restriction_reason: str = None, + permissions: "pyrogram.ChatPermissions" = None + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/user_and_chats/chat_member.py b/pyrogram/client/types/user_and_chats/chat_member.py index 5769b3f8..07a3d190 100644 --- a/pyrogram/client/types/user_and_chats/chat_member.py +++ b/pyrogram/client/types/user_and_chats/chat_member.py @@ -51,16 +51,20 @@ class ChatMember(PyrogramType): Information about the member permissions. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - user: "pyrogram.User", - status: str, - date: int = None, - invited_by: "pyrogram.User" = None, - promoted_by: "pyrogram.User" = None, - restricted_by: "pyrogram.User" = None, - permissions: "pyrogram.ChatPermissions" = None): + __slots__ = ["user", "status", "date", "invited_by", "promoted_by", "restricted_by", "permissions"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + user: "pyrogram.User", + status: str, + date: int = None, + invited_by: "pyrogram.User" = None, + promoted_by: "pyrogram.User" = None, + restricted_by: "pyrogram.User" = None, + permissions: "pyrogram.ChatPermissions" = None + ): super().__init__(client) self.user = user diff --git a/pyrogram/client/types/user_and_chats/chat_members.py b/pyrogram/client/types/user_and_chats/chat_members.py index 39d69089..0578e04e 100644 --- a/pyrogram/client/types/user_and_chats/chat_members.py +++ b/pyrogram/client/types/user_and_chats/chat_members.py @@ -21,7 +21,6 @@ from typing import List import pyrogram from pyrogram.api import types from .chat_member import ChatMember -from .user import User from ..pyrogram_type import PyrogramType @@ -36,11 +35,15 @@ class ChatMembers(PyrogramType): Requested chat members. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - total_count: int, - chat_members: List[ChatMember]): + __slots__ = ["total_count", "chat_members"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + total_count: int, + chat_members: List[ChatMember] + ): super().__init__(client) self.total_count = total_count diff --git a/pyrogram/client/types/user_and_chats/chat_permissions.py b/pyrogram/client/types/user_and_chats/chat_permissions.py index a931cd7a..4a4785b5 100644 --- a/pyrogram/client/types/user_and_chats/chat_permissions.py +++ b/pyrogram/client/types/user_and_chats/chat_permissions.py @@ -94,6 +94,13 @@ class ChatPermissions(PyrogramType): True, if polls can be sent, implies can_send_media_messages. """ + __slots__ = [ + "until_date", "can_be_edited", "can_change_info", "can_post_messages", "can_edit_messages", + "can_delete_messages", "can_restrict_members", "can_invite_users", "can_pin_messages", "can_promote_members", + "can_send_messages", "can_send_media_messages", "can_send_other_messages", "can_add_web_page_previews", + "can_send_polls" + ] + def __init__( self, *, diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py index 848f7250..deec5770 100644 --- a/pyrogram/client/types/user_and_chats/chat_photo.py +++ b/pyrogram/client/types/user_and_chats/chat_photo.py @@ -35,11 +35,15 @@ class ChatPhoto(PyrogramType): Unique file identifier of big (640x640) chat photo. This file_id can be used only for photo download. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - small_file_id: str, - big_file_id: str): + __slots__ = ["small_file_id", "big_file_id"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + small_file_id: str, + big_file_id: str + ): super().__init__(client) self.small_file_id = small_file_id diff --git a/pyrogram/client/types/user_and_chats/chat_preview.py b/pyrogram/client/types/user_and_chats/chat_preview.py index 45048637..9c9c71ec 100644 --- a/pyrogram/client/types/user_and_chats/chat_preview.py +++ b/pyrogram/client/types/user_and_chats/chat_preview.py @@ -45,14 +45,18 @@ class ChatPreview(PyrogramType): Preview of some of the chat members. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - title: str, - photo: ChatPhoto, - type: str, - members_count: int, - members: List[User] = None): + __slots__ = ["title", "photo", "type", "members_count", "members"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + title: str, + photo: ChatPhoto, + type: str, + members_count: int, + members: List[User] = None + ): super().__init__(client) self.title = title diff --git a/pyrogram/client/types/user_and_chats/dialog.py b/pyrogram/client/types/user_and_chats/dialog.py index b71caba7..11a1ae19 100644 --- a/pyrogram/client/types/user_and_chats/dialog.py +++ b/pyrogram/client/types/user_and_chats/dialog.py @@ -46,15 +46,19 @@ class Dialog(PyrogramType): True, if the dialog is pinned. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - chat: Chat, - top_message: "pyrogram.Message", - unread_messages_count: int, - unread_mentions_count: int, - unread_mark: bool, - is_pinned: bool): + __slots__ = ["chat", "top_message", "unread_messages_count", "unread_mentions_count", "unread_mark", "is_pinned"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + chat: Chat, + top_message: "pyrogram.Message", + unread_messages_count: int, + unread_mentions_count: int, + unread_mark: bool, + is_pinned: bool + ): super().__init__(client) self.chat = chat diff --git a/pyrogram/client/types/user_and_chats/dialogs.py b/pyrogram/client/types/user_and_chats/dialogs.py index 394ddd28..27222a91 100644 --- a/pyrogram/client/types/user_and_chats/dialogs.py +++ b/pyrogram/client/types/user_and_chats/dialogs.py @@ -36,11 +36,15 @@ class Dialogs(PyrogramType): Requested dialogs. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - total_count: int, - dialogs: List[Dialog]): + __slots__ = ["total_count", "dialogs"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + total_count: int, + dialogs: List[Dialog] + ): super().__init__(client) self.total_count = total_count diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index c6ee03e8..f5c00ac0 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -70,23 +70,30 @@ class User(PyrogramType): The reason why this bot might be unavailable to some users. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - id: int, - is_self: bool, - is_contact: bool, - is_mutual_contact: bool, - is_deleted: bool, - is_bot: bool, - first_name: str, - last_name: str = None, - status: UserStatus = None, - username: str = None, - language_code: str = None, - phone_number: str = None, - photo: ChatPhoto = None, - restriction_reason: str = None): + __slots__ = [ + "id", "is_self", "is_contact", "is_mutual_contact", "is_deleted", "is_bot", "first_name", "last_name", "status", + "username", "language_code", "phone_number", "photo", "restriction_reason" + ] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + id: int, + is_self: bool, + is_contact: bool, + is_mutual_contact: bool, + is_deleted: bool, + is_bot: bool, + first_name: str, + last_name: str = None, + status: UserStatus = None, + username: str = None, + language_code: str = None, + phone_number: str = None, + photo: ChatPhoto = None, + restriction_reason: str = None + ): super().__init__(client) self.id = id diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py index 8c936f8e..871978d0 100644 --- a/pyrogram/client/types/user_and_chats/user_status.py +++ b/pyrogram/client/types/user_and_chats/user_status.py @@ -65,17 +65,21 @@ class UserStatus(PyrogramType, Update): always shown to blocked users), None otherwise. """ - def __init__(self, - *, - client: "pyrogram.client.ext.BaseClient", - user_id: int, - online: bool = None, - offline: bool = None, - date: int = None, - recently: bool = None, - within_week: bool = None, - within_month: bool = None, - long_time_ago: bool = None): + __slots__ = ["user_id", "online", "offline", "date", "recently", "within_week", "within_month", "long_time_ago"] + + def __init__( + self, + *, + client: "pyrogram.client.ext.BaseClient", + user_id: int, + online: bool = None, + offline: bool = None, + date: int = None, + recently: bool = None, + within_week: bool = None, + within_month: bool = None, + long_time_ago: bool = None + ): super().__init__(client) self.user_id = user_id