Embed (Legacy)¶
Note
The following classes come from the scurrypy.parts.embed module.
EmbedPart
dataclass
¶
Bases: DataModel
Represents the Embed portion of a message.
title: Optional[str] = None
class-attribute
instance-attribute
¶
This embed's title.
description: Optional[str] = None
class-attribute
instance-attribute
¶
This embed's description.
timestamp: Optional[str] = None
class-attribute
instance-attribute
¶
Timestamp of when the embed was sent.
color: Optional[int] = None
class-attribute
instance-attribute
¶
Embed's accent color.
author: Optional[EmbedAuthor] = None
class-attribute
instance-attribute
¶
Embed's author.
thumbnail: Optional[EmbedThumbnail] = None
class-attribute
instance-attribute
¶
Embed's thumbnail attachment.
image: Optional[EmbedImage] = None
class-attribute
instance-attribute
¶
Embed's image attachment.
fields: Optional[list[EmbedField]] = field(default_factory=list)
class-attribute
instance-attribute
¶
List of embed's fields.
footer: Optional[EmbedFooter] = None
class-attribute
instance-attribute
¶
Embed's footer.
to_dict
¶
EXCEPTION to the "models contain no custom methods" rule for two reasons:
-
to_dictalready exists on all models via inheritance, so overriding it does not break the design model. -
Thumbnail(Component V2) andEmbedThumbnail(Embed-only) are extremely easy to confuse. This guard catches the mistake early and provides a clear, actionable error instead of allowing Discord to return an obscure 400 error.
EmbedAuthor
dataclass
¶
Bases: DataModel
Embed author parameters.
name: str
instance-attribute
¶
Name of the author.
url: Optional[str] = None
class-attribute
instance-attribute
¶
URL of the author. http or attachment://
icon_url: Optional[str] = None
class-attribute
instance-attribute
¶
URL of author's icon. http or attachment://
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
EmbedThumbnail
dataclass
¶
EmbedField
dataclass
¶
Bases: DataModel
Embed field.
name: str
instance-attribute
¶
Name of the field.
value: str
instance-attribute
¶
Value of the field.
inline: Optional[bool] = None
class-attribute
instance-attribute
¶
Whether or not this field should display inline.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss