Skip to content

Message Events

Note

The following classes come from the scurrypy.events.message_events module.


MessageCreateEvent dataclass

Bases: Event, MessageModel

Received when a message is created. (This event IS the MessageModel with extra fields)

Note

member may be missing on MESSAGE_CREATE and MESSAGE_UPDATE. Use author when you need the user.

guild_id: Optional[int] instance-attribute

Guild ID of the updated message (if in a guild channel).

member: Optional[GuildMemberModel] instance-attribute

Partial Member object of the author of the message. See GuildMemberModel.

id: int instance-attribute

ID of the message.

channel_id: int instance-attribute

Channel ID of the message.

author: UserModel instance-attribute

User data of author of the message.

content: str instance-attribute

Content of the message.

pinned: bool instance-attribute

If the message is pinned.

type: int instance-attribute

Type of message.

webhook_id: Optional[int] instance-attribute

ID of the webhook if the message is a webhook.

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


MessageUpdateEvent dataclass

Bases: Event, MessageModel

Received when a message is updated. (This event IS the MessageModel with extra fields)

guild_id: Optional[int] instance-attribute

Guild ID of the updated message (if in a guild channel).

member: Optional[GuildMemberModel] instance-attribute

Partial Member object of the author of the message. See GuildMemberModel.

id: int instance-attribute

ID of the message.

channel_id: int instance-attribute

Channel ID of the message.

author: UserModel instance-attribute

User data of author of the message.

content: str instance-attribute

Content of the message.

pinned: bool instance-attribute

If the message is pinned.

type: int instance-attribute

Type of message.

webhook_id: Optional[int] instance-attribute

ID of the webhook if the message is a webhook.

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


MessageDeleteEvent dataclass

Bases: Event, DataModel

Received when a message is deleted.

id: int instance-attribute

ID of the deleted message.

channel_id: int instance-attribute

Channel ID of the deleted message.

guild_id: Optional[int] instance-attribute

Guild ID of the deleted message (if in a guild channel).

name: str instance-attribute

Dispatch name of event.

raw: dict instance-attribute

Event's raw JSON payload. NOT A DATACLASS.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss