-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(emoji): implement app emojis #1224
base: master
Are you sure you want to change the base?
Conversation
I marked this ready for review even though i still don't know if we should provide the ability to cache app emojis at startup, as you can see i did put a boolean argument but didn't implement any logic for it so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the documentation, referring the emojis as "application emojis" instead of "app emojis" would be more consistent
Parameters | ||
---------- | ||
name: :class:`str` | ||
The name of the new string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the new string. | |
The emoji name. Must be at least 2 characters. |
Retrieves all the :class:`.Emoji` of the application. | ||
|
||
.. versionadded:: 2.10 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -51,6 +51,10 @@ class Emoji(_EmojiTag, AssetMixin): | |||
|
|||
Returns the emoji rendered for Discord. | |||
|
|||
.. versionchanched:: 2.10 | |||
|
|||
This class can now represents app emojis too. Denoted by having :attr:`.Emoji.guild_id` as ``None``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a is_app_emoji
property would be nice here
|
||
@property | ||
def application_id(self) -> Optional[int]: | ||
""":class:`int`: The ID of the application which owns this emoji. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""":class:`int`: The ID of the application which owns this emoji. | |
"""Optional[:class:`int`]: The ID of the application which owns this emoji. |
.. versionadded:: 2.10 | ||
""" | ||
if self.guild is None: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return | |
return None |
@@ -51,6 +51,10 @@ class Emoji(_EmojiTag, AssetMixin): | |||
|
|||
Returns the emoji rendered for Discord. | |||
|
|||
.. versionchanched:: 2.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionchanched:: 2.10 | |
.. versionchanged:: 2.10 |
HTTPException | ||
An error occurred creating an app emoji. | ||
TypeError | ||
The ``image`` asset is a lottie sticker (see :func:`Sticker.read`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ``image`` asset is a lottie sticker (see :func:`Sticker.read`). | |
The ``image`` asset is a lottie sticker (see :func:`Sticker.read <disnake.Sticker.read>`). |
"""Optional[:class:`Guild`]: The guild this emoji belongs to. | ||
|
||
``None`` if this is an app emoji. | ||
|
||
.. versionchanged:: 2.10 | ||
|
||
This can now return ``None`` if the emoji is an | ||
application owned emoji. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Optional[:class:`Guild`]: The guild this emoji belongs to. | |
``None`` if this is an app emoji. | |
.. versionchanged:: 2.10 | |
This can now return ``None`` if the emoji is an | |
application owned emoji. | |
""" | |
"""Optional[:class:`Guild`]: The guild this emoji belongs to. ``None`` if this is an app emoji. | |
.. versionchanged:: 2.10 | |
This can now return ``None`` if the emoji is an | |
application owned emoji. | |
""" |
Summary
Checklist
pdm lint
pdm pyright