-
-
Notifications
You must be signed in to change notification settings - Fork 247
Embed types #1396
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
Embed types #1396
Conversation
Still need to add the valid fields for each type as a const array to those classes |
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.
Changing the return type of thumbnail is technically a breaking change, however it has the same data structure as image (for now). Unless someone's bot is explicitly checking for the type hinted result this change is inconsequential.
These will be updated again with #1396
This pull request refactors and extends the embed system in the DiscordPHP project to support multiple embed types and improve type safety for embed attributes. It introduces dedicated classes for each embed type, updates property definitions for better nullability and documentation, and adds support for new embed structures like
Provider
andThumbnail
.Embed system refactoring and type support
EmbedRich
,EmbedImage
,EmbedVideo
,EmbedGifv
,EmbedArticle
,EmbedLink
,EmbedPollResult
) and a type mapping inEmbed::TYPES
to instantiate the correct class based on the embed's type. [1] [2] [3] [4] [5] [6] [7] [8] [9]Message.php
to use the new type mapping for instantiating embed objects.poll_result
embed type in the embed types list.Attribute and property improvements
Embed
,Author
,Footer
,Field
,Image
,Video
) to use?type|null
for optional properties and updated docblocks for accuracy. [1] [2] [3] [4] [5] [6]thumbnail
attribute inEmbed
to use the newThumbnail
class instead ofImage
, and added a getter for the newProvider
attribute. [1] [2]New embed structure classes
Provider
andThumbnail
to represent their respective embed structures, with appropriate fillable fields and documentation. [1] [2]