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(flags): add new flags to Embed and update Attachment flags #1283

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

Conversation

Snipy7374
Copy link
Collaborator

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, ...)

Snipy7374

This comment was marked as off-topic.

return 1 << 3

@flag_value
def contains_explicit_media(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thoughts on calling this something different? Like is_nsfw or is_explicit

"""

@flag_value
def contains_explicit_media(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thoughts on calling this something different? Like is_nsfw or is_explicit

Comment on lines +274 to +284
if self._thumbnail and (thumbnail_flags := self._thumbnail.get("flags")):
self._thumbnail["flags"] = EmbedMediaFlags._from_value(thumbnail_flags) # type: ignore

self._video = data.get("video")
self._provider = data.get("provider")
self._author = data.get("author")

self._image = data.get("image")
if self._image and (image_flags := self._image.get("flags")):
self._image["flags"] = EmbedMediaFlags._from_value(image_flags) # type: ignore

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't like how this is done but I don't see much alternatives

@Snipy7374 Snipy7374 added t: enhancement New feature t: api support Support of Discord API features s: waiting for api/docs Issue/PR is waiting for API support/documentation labels Jan 31, 2025
@@ -220,6 +223,7 @@ def __init__(
self._image: Optional[EmbedImagePayload] = None
self._footer: Optional[EmbedFooterPayload] = None
self._fields: Optional[List[EmbedFieldPayload]] = None
self._flags: Optional[int] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not default to 0?

@@ -455,6 +477,11 @@ def image(self) -> _EmbedMediaProxy:
- ``proxy_url``
- ``width``
- ``height``
- ``flags``

.. versionchanged:: 2.11
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be versionadded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: waiting for api/docs Issue/PR is waiting for API support/documentation t: api support Support of Discord API features t: enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embed and Attachment API is outdated
2 participants