MessageBuilder¶
Note
The following classes come from the discord.parts.message
module.
MessageBuilder
dataclass
¶
Bases: DataModel
Describes expected params when editing/creating a message.
content: Optional[str] = None
class-attribute
instance-attribute
¶
Message text content.
flags: Optional[int] = 0
class-attribute
instance-attribute
¶
Message flags. See MessageFlags
for details.
components: Optional[list[ActionRow | Container]] = field(default_factory=list)
class-attribute
instance-attribute
¶
Components to be attached to this message.
attachments: Optional[list[_Attachment]] = field(default_factory=list)
class-attribute
instance-attribute
¶
Attachments to be attached to this message.
embeds: Optional[list[EmbedBuilder]] = field(default_factory=list)
class-attribute
instance-attribute
¶
Embeds to be attached to this message.
message_reference: Optional[_MessageReference] = None
class-attribute
instance-attribute
¶
Message reference if reply.
add_row
¶
Add an action row to this message.
Parameters:
-
row
(ActionRow
) –the ActionRow object
Returns:
-
MessageBuilder
–self
add_container
¶
Add a container to this message.
Parameters:
-
container
(Container
) –the Container object.
-
has_container_boarder
(bool
, default:False
) –If message should be contained in an Embed-like container. Defaults to False.
Returns:
-
MessageBuilder
–self
add_embed
¶
Add an embed to this message.
Parameters:
-
embed
(EmbedBuilder
) –The EmbedBuilder object.
Returns:
-
MessageBuilder
–self
add_attachment
¶
Add an attachment to this message
Parameters:
-
file_path
(str
) –full qualifying path to file
-
description
(str
, default:None
) –file descriptor. Defaults to None.
Returns:
-
MessageBuilder
–self
set_flags
¶
Set this message's flags using MessageFlagParams.
Parameters:
-
flags
(Unpack[MessageFlagParams]
, default:{}
) –message flags to set. (set respective flag to True to toggle.)
Raises:
-
ValueError
–invalid flag
Returns:
-
MessageBuilder
–self
MessageFlagParams
¶
Note
Each parameter maps directly to a constant in MessageFlags
.
MessageFlags
¶
Flags that can be applied to a message.
CROSSPOSTED = 1 << 0
class-attribute
instance-attribute
¶
Message has been published.
IS_CROSSPOST = 1 << 1
class-attribute
instance-attribute
¶
Message originated from another channel.
SUPPRESS_EMBEDS = 1 << 2
class-attribute
instance-attribute
¶
Hide embeds (if any).
EPHEMERAL = 1 << 6
class-attribute
instance-attribute
¶
Only visible to the invoking user.
LOADING = 1 << 7
class-attribute
instance-attribute
¶
Thinking response.
IS_COMPONENTS_V2 = 1 << 15
class-attribute
instance-attribute
¶
This message includes Discord's V2 Components.