diff options
| author | Rapptz <[email protected]> | 2021-06-02 05:28:07 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-06-02 05:30:42 -0400 |
| commit | 47f2d04940921a0853f66ee39615db4f0994cece (patch) | |
| tree | 85293c983f32bff15d238a69a60f068bd6b94304 /discord/emoji.py | |
| parent | Properly type hint attributes in Emoji (diff) | |
| download | discord.py-47f2d04940921a0853f66ee39615db4f0994cece.tar.xz discord.py-47f2d04940921a0853f66ee39615db4f0994cece.zip | |
Allow passing Emoji in components
Diffstat (limited to 'discord/emoji.py')
| -rw-r--r-- | discord/emoji.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/emoji.py b/discord/emoji.py index f661ecd3..0630bdcd 100644 --- a/discord/emoji.py +++ b/discord/emoji.py @@ -27,7 +27,7 @@ from typing import Any, Iterator, List, Optional, TYPE_CHECKING, Tuple from .asset import Asset, AssetMixin from .utils import SnowflakeList, snowflake_time, MISSING -from .partial_emoji import _EmojiTag +from .partial_emoji import _EmojiTag, PartialEmoji from .user import User __all__ = ( @@ -122,6 +122,9 @@ class Emoji(_EmojiTag, AssetMixin): user = emoji.get('user') self.user: Optional[User] = User(state=self._state, data=user) if user else None + def _to_partial(self) -> PartialEmoji: + return PartialEmoji(name=self.name, animated=self.animated, id=self.id) + def __iter__(self) -> Iterator[Tuple[str, Any]]: for attr in self.__slots__: if attr[0] != '_': |