MessageBuilder¶
Note
The following classes come from the scurrypy.parts.message module.
MessagePart
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.
Note
Flags are ignored if editing an existing message.
components: Optional[list[ActionRowPart | ContainerPart]] = 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[EmbedPart]] = 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.
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:
-
MessagePart–self
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
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.
MessageFlagParams
¶
Bases: TypedDict
Parameters for setting message flags. See MessageFlags.
MessageReference
dataclass
¶
Bases: DataModel
Represents the Message Reference object.
message_id: int
instance-attribute
¶
ID of the originating message.
channel_id: int
instance-attribute
¶
Channel ID of the originating message.
Note
Optional for default type, but REQUIRED for forwards.
type: int = MessageReferenceTypes.DEFAULT
class-attribute
instance-attribute
¶
Type of reference. Defaults to DEFAULT. See MessageReferenceTypes.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss