MessagePart¶
Note
The following classes come from the scurrypy.parts.message module.
MessagePart
dataclass
¶
Bases: DataModel
Represents a Discord Message.
content: Optional[str] = None
class-attribute
instance-attribute
¶
Message text content.
flags: Optional[int] = MessageFlags.NO_FLAGS
class-attribute
instance-attribute
¶
Message flags. Defaults to MessageFlags.NO_FLAGS. See MessageFlags.
components: Optional[list[ActionRowPart | ContainerPart]] = field(default_factory=list)
class-attribute
instance-attribute
¶
Components to be attached to this message.
attachments: Optional[list[AttachmentPart]] = 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[MessageReferencePart] = None
class-attribute
instance-attribute
¶
Message reference if reply.
set_flags
¶
Set this message's flags using MessageFlagParams.
Parameters:
-
flags(MessageFlagParams, default:{}) –message flags to set
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.
NO_FLAGS = 0
class-attribute
instance-attribute
¶
Message has no flags.
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.
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.
MessageReferencePart
dataclass
¶
Bases: DataModel
Represents the Message Reference object.
message_id: int = None
class-attribute
instance-attribute
¶
ID of the originating message.
channel_id: int = None
class-attribute
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 MessageReferenceTypes.DEFAULT. See MessageReferenceTypes.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss