Embed
Represents a Discord embed. Embeds allow you to send rich, formatted messages with images, fields, and more.Constructor
The title of the embed. Must be 256 characters or fewer.
The description of the embed. Must be 4096 characters or fewer.
The colour code of the embed. Aliased to
color as well.The URL of the embed.
The timestamp of the embed content. This is an aware datetime.
Attributes
The title of the embed.
The description of the embed.
The colour code of the embed. Aliased to
color as well.The URL of the embed.
The timestamp of the embed content.
Returns an
EmbedFooter denoting the footer contents. If the footer is not set then None is returned.Returns an
EmbedMedia denoting the image contents. If the image is not set then None is returned.Returns an
EmbedMedia denoting the thumbnail contents. If the thumbnail is not set then None is returned.Returns an
EmbedMedia denoting the video contents. If the video is not set then None is returned.Returns an
EmbedAuthor denoting the author contents. If the author is not set then None is returned.Returns a list of
EmbedField objects denoting the field contents.Methods
set_footer(text, icon_url=None)
set_footer(text, icon_url=None)
set_image(url)
set_image(url)
Sets the image for the embed content. This function returns the class instance to allow for fluent-style chaining.Returns:
The source URL for the image. Only HTTP(S) is supported.
Embed - The embed instance for chaining.Example:set_thumbnail(url)
set_thumbnail(url)
Sets the thumbnail for the embed content. This function returns the class instance to allow for fluent-style chaining.Returns:
The source URL for the thumbnail. Only HTTP(S) is supported.
Embed - The embed instance for chaining.Example:set_author(name, url=None, icon_url=None)
set_author(name, url=None, icon_url=None)
add_field(name, value, inline=True)
add_field(name, value, inline=True)
Adds a field to the embed object. This function returns the class instance to allow for fluent-style chaining. There must be 25 fields or fewer.Returns:
The name of the field. Must be 256 characters or fewer.
The value of the field. Must be 1024 characters or fewer.
Whether the field should be displayed inline. Defaults to True.
Embed - The embed instance for chaining.Example:insert_field_at(index, name, value, inline=True)
insert_field_at(index, name, value, inline=True)
Inserts a field before a specified index to the embed. This function returns the class instance to allow for fluent-style chaining.Returns:
The index of where to insert the field.
The name of the field. Must be 256 characters or fewer.
The value of the field. Must be 1024 characters or fewer.
Whether the field should be displayed inline.
Embed - The embed instance for chaining.Example:set_field_at(index, name, value, inline=True)
set_field_at(index, name, value, inline=True)
Modifies a field to the embed object. The index must point to a valid pre-existing field.Returns:
The index of the field to modify.
The name of the field.
The value of the field.
Whether the field should be displayed inline.
Embed - The embed instance for chaining.Example:remove_field(index)
remove_field(index)
Removes a field at a specified index. If the index is invalid or out of bounds then the error is silently swallowed.Example:
The index of the field to remove.
clear_fields()
clear_fields()
Removes all fields from this embed.Example:
remove_author()
remove_author()
remove_footer()
remove_footer()
remove_image()
remove_image()
Removes the embed’s image. This function returns the class instance to allow for fluent-style chaining.Returns:
Embed - The embed instance for chaining.remove_thumbnail()
remove_thumbnail()
Removes the embed’s thumbnail. This function returns the class instance to allow for fluent-style chaining.Returns:
Embed - The embed instance for chaining.copy()
copy()
Creates a shallow copy of the
Embed object.Returns: Embed - The copied embed object.Example:to_dict()
to_dict()
Converts this embed object into a dict.Returns:
dict - A dictionary of embed keys bound to the respective value.Example:from_dict(data)
from_dict(data)
Converts a dict to an Returns:
Embed provided it is in the format that Discord expects it to be in.The dictionary to convert into an embed.
Embed - The converted embed object.Example:Example Usage
Character Limits
- Title: 256 characters
- Description: 4096 characters
- Field Name: 256 characters
- Field Value: 1024 characters
- Footer Text: 2048 characters
- Author Name: 256 characters
- Total Characters: 6000 characters (sum of all fields)
- Maximum Fields: 25 fields
