Embeds

discord_http.embeds module

class discord_http.embeds.Embed(*, title=None, description=None, colour=None, color=None, url=None, timestamp=None)

Bases: object

Represents a Discord embed.

Parameters:
colour: Colour | int | None

The colour of the embed, if any.

type: Literal['rich', 'image', 'video', 'gifv', 'article', 'link', 'poll_result']

The type of the embed, which can be “rich”, “image”, “video”, “gifv”, “article”, “link”, or “poll_result”. Defaults to “rich”.

footer: EmbedFooter | None

The footer of the embed, if any.

author: EmbedAuthor | None

The author of the embed, if any.

image: EmbedMedia | None

The image of the embed, if any.

thumbnail: EmbedMedia | None

The thumbnail of the embed, if any.

fields: list[EmbedField]

The fields of the embed, if any.

title: str | None

The title of the embed, if any.

description: str | None

The description of the embed, if any.

url: str | None

The URL of the embed, if any.

timestamp: datetime | None

The timestamp of the embed, if any.

copy() Self

Returns a copy of the embed.

Return type:

Self

set_colour(value) Self

Set the colour of the embed.

Parameters:

value (Colour | int | None) – The colour to set the embed to. If None, the colour will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_colour() Self

Remove the colour from the embed.

Return type:

Self

Returns:

Returns the embed you are editing

Set the footer of the embed.

Parameters:
  • text (str | None) – The text of the footer

  • icon_url (Asset | str | None) – Icon URL of the footer

Return type:

Self

Returns:

Returns the embed you are editing

Remove the footer from the embed.

Return type:

Self

Returns:

Returns the embed you are editing

set_author(*, name, url=None, icon_url=None) Self

Set the author of the embed.

Parameters:
  • name (str) – The name of the author

  • url (str | None) – The URL which the author name will link to

  • icon_url (Asset | str | None) – The icon URL of the author

Return type:

Self

Returns:

Returns the embed you are editing

remove_author() Self

Remove the author from the embed.

Return type:

Self

Returns:

Returns the embed you are editing

set_image(*, url=None) Self

Set the image of the embed.

Parameters:

url (Asset | str | None) – The URL of the image

Return type:

Self

Returns:

Returns the embed you are editing

remove_image() Self

Remove the image from the embed.

Return type:

Self

Returns:

Returns the embed you are editing

set_thumbnail(*, url=None) Self

Set the thumbnail of the embed.

Parameters:

url (Asset | str | None) – The URL of the thumbnail

Return type:

Self

Returns:

Returns the embed you are editing

remove_thumbnail() Self

Remove the thumbnail from the embed.

Return type:

Self

Returns:

Returns the embed you are editing

add_field(*, name, value, inline=True) Self

Add a field to the embed.

Parameters:
  • name (str) – Title of the field

  • value (str) – Description of the field

  • inline (bool) – Whether the field is inline or not

Return type:

Self

Returns:

Returns the embed you are editing

remove_field(index) Self

Remove a field from the embed.

Parameters:

index (int) – The index of the field to remove

Return type:

Self

Returns:

Returns the embed you are editing

classmethod from_dict(data) Self

Create an embed from a dictionary.

Parameters:

data (dict) – The dictionary to create the embed from

Return type:

Self

Returns:

The embed created from the dictionary

to_dict() dict

The embed as a dictionary.

Return type:

dict