Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Snipy7374
Copy link
Collaborator

@Snipy7374 Snipy7374 commented Aug 10, 2024

Summary

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@shiftinv shiftinv added t: enhancement New feature t: api support Support of Discord API features s: in progress Issue/PR is being worked on labels Aug 11, 2024
@Snipy7374 Snipy7374 marked this pull request as ready for review August 21, 2024 09:56
@Snipy7374
Copy link
Collaborator Author

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.

Copy link
Member

@Victorsitou Victorsitou left a 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -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``.
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""":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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return
return None

@@ -51,6 +51,10 @@ class Emoji(_EmojiTag, AssetMixin):

Returns the emoji rendered for Discord.

.. versionchanched:: 2.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. 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`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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>`).

Comment on lines +169 to +177
"""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.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""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.
"""

@shiftinv shiftinv self-requested a review November 14, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: in progress Issue/PR is being worked on t: api support Support of Discord API features t: enhancement New feature
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

implement app emojis
3 participants