From 04b343f61b9e85cdcc2a81b20267097a5a4eedab Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 3 Sep 2022 14:06:46 +0200 Subject: [PATCH] Add get_default_emoji_statuses method --- compiler/docs/compiler.py | 1 + pyrogram/methods/users/__init__.py | 2 + .../users/get_default_emoji_statuses.py | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 pyrogram/methods/users/get_default_emoji_statuses.py diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index f642f288..149cdcf0 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -251,6 +251,7 @@ def pyrogram_api(): block_user unblock_user get_common_chats + get_default_emoji_statuses """, invite_links=""" Invite Links diff --git a/pyrogram/methods/users/__init__.py b/pyrogram/methods/users/__init__.py index 2ed719e8..52c4699f 100644 --- a/pyrogram/methods/users/__init__.py +++ b/pyrogram/methods/users/__init__.py @@ -21,6 +21,7 @@ from .delete_profile_photos import DeleteProfilePhotos from .get_chat_photos import GetChatPhotos from .get_chat_photos_count import GetChatPhotosCount from .get_common_chats import GetCommonChats +from .get_default_emoji_statuses import GetDefaultEmojiStatuses from .get_me import GetMe from .get_users import GetUsers from .set_profile_photo import SetProfilePhoto @@ -41,5 +42,6 @@ class Users( GetChatPhotosCount, UnblockUser, UpdateProfile, + GetDefaultEmojiStatuses ): pass diff --git a/pyrogram/methods/users/get_default_emoji_statuses.py b/pyrogram/methods/users/get_default_emoji_statuses.py new file mode 100644 index 00000000..b4d707bd --- /dev/null +++ b/pyrogram/methods/users/get_default_emoji_statuses.py @@ -0,0 +1,43 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-present Dan +# +# This file is part of Pyrogram. +# +# Pyrogram is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrogram is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . + +import pyrogram +from pyrogram import raw +from pyrogram import types + + +class GetDefaultEmojiStatuses: + async def get_default_emoji_statuses( + self: "pyrogram.Client", + ) -> types.List["types.EmojiStatus"]: + """Get the default emoji statuses. + + Returns: + List of :obj:`~pyrogram.types.EmojiStatus`: On success, a list of emoji statuses is returned. + + Example: + .. code-block:: python + + default_emoji_statuses = await app.get_default_emoji_statuses() + print(default_emoji_statuses) + """ + r = await self.invoke( + raw.functions.account.GetDefaultEmojiStatuses(hash=0) + ) + + return types.List([types.EmojiStatus._parse(self, i) for i in r.statuses])