-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Add EmbedField
object to allow for easier embed class instance creation
#1181
Conversation
|
That's my plan as part of this PR, just haven't gotten there yet. |
fix typing for fields parameter in Embed.__init__ fix typing for Embed.fields property change Embed.add_field, Embed.insert_field_at to use an EmbedField object when appending to Embed._fields change Embed.set_field_at to set EmbedField properties instead of dictionary values
EmbedField
object to allow for easier embed class instance creationEmbedField
object to allow for easier embed class instance creation
This is now ready for review. |
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.
I think we should add versionadded
to the new class and the new methods.
Summary
This adds a new object
EmbedField
, which corresponds to the object of the same name in the API Documentation. This also follows the same conventions used by other libraries (i.e. treating EmbedField as a higher level object), such as discord.js, DisCatSharp, and many others.A parameter
fields
has also been added to the__init__
method for theEmbed
class, which allows passing a list ofEmbedField
objects when creating a new embed, instead of needing to useEmbed.add_field()
for each field. It also adds a setter for thefields
property which accomplishes the same thing for existing embeds.This is a breaking change only if you were somehow using the private
_EmbedFieldProxy
class for anything, as this has now been removed in favor ofEmbedField
.Checklist
type: ignore
comments were used, a comment is also left explaining why