Skip to content

hikari.events.message_events#

Events that fire if messages are sent/updated/deleted.

DMMessageCreateEvent #

Bases: MessageCreateEvent

Event that is fired when a message is created within a DM.

This contains the full message in the internal message attribute.

app property #

app: RESTAware

App instance for this application.

author property #

author: User

User that sent the message.

author_id property #

author_id: Snowflake

ID of the author of the message this event concerns.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: Optional[str]

Content of the message.

The content of the message, if present. This will be None if no content is present (e.g. if only an embed was sent).

embeds property #

embeds: Sequence[Embed]

Sequence of embeds in the message.

is_bot property #

is_bot: bool

Return True if the message is from a bot.

is_human property #

is_human: bool

Return True if the message was created by a human.

is_webhook property #

is_webhook: bool

Return True if the message was created by a webhook.

message class-attribute instance-attribute #

message: Message = field()

Message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

DMMessageDeleteEvent #

Bases: MessageDeleteEvent

Event that is triggered if a message is deleted in a DM.

Note

Due to Discord limitations, most message information is unavailable during deletion events.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel that this event concerns.

message_id class-attribute instance-attribute #

message_id: Snowflake = field()

ID of the message that was deleted.

old_message class-attribute instance-attribute #

old_message: Optional[Message] = field()

Object of the message that was deleted.

Will be None if the message was not found in the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

DMMessageUpdateEvent #

Bases: MessageUpdateEvent

Event that is fired when a message is updated in a DM.

Note

Less information will be available here than in the creation event due to Discord limitations.

app property #

app: RESTAware

App instance for this application.

author property #

author: UndefinedOr[User]

User that sent the message.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

author_id property #

author_id: UndefinedOr[Snowflake]

ID of the author that triggered this event.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: UndefinedNoneOr[str]

Content of the message.

The content of the message, if present. This may be None if no content is present (e.g. if only an embed was sent).

If not part of the update, then this will be hikari.undefined.UNDEFINED instead.

embeds property #

Sequence of embeds in the message.

If the embeds were not changed in this event, then this may instead be hikari.undefined.UNDEFINED.

is_bot property #

is_bot: UndefinedOr[bool]

Whether the message is from a bot.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this will return hikari.undefined.UNDEFINED instead.

is_human property #

is_human: UndefinedOr[bool]

Whether the message was created by a human.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

is_webhook property #

is_webhook: UndefinedOr[bool]

Whether the message was created by a webhook.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

message class-attribute instance-attribute #

message: PartialMessage = field()

Partial message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

old_message class-attribute instance-attribute #

old_message: Optional[PartialMessage] = field()

The old message object.

This will be None if the message missing from the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

GuildBulkMessageDeleteEvent #

Bases: ShardEvent

Event that is triggered when a bulk deletion is triggered in a guild.

Note

Due to Discord limitations, most message information is unavailable during deletion events.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel that this event concerns.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event occurred in.

message_ids class-attribute instance-attribute #

message_ids: AbstractSet[Snowflake] = field()

Set of message IDs that were bulk deleted.

old_messages class-attribute instance-attribute #

old_messages: Mapping[Snowflake, Message] = field()

Mapping of a snowflake to the deleted message object.

If the message was not found in the cache it will be missing from the mapping.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

get_channel #

get_channel() -> Optional[TextableGuildChannel]

Get the cached channel the messages were sent in, if known.

RETURNS DESCRIPTION
Optional[TextableGuildChannel]

The channel the messages were sent in, or None if not known/cached.

get_guild #

get_guild() -> Optional[GatewayGuild]

Get the cached guild this event corresponds to, if known.

Note

You will need hikari.intents.Intents.GUILDS enabled to receive this information.

RETURNS DESCRIPTION
GatewayGuild

The gateway guild that this event corresponds to, if known and cached.

GuildMessageCreateEvent #

Bases: MessageCreateEvent

Event that is fired when a message is created within a guild.

This contains the full message in the internal message attribute.

app property #

app: RESTAware

App instance for this application.

author property #

author: User

User object of the user that sent the message.

author_id property #

author_id: Snowflake

ID of the author of the message this event concerns.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: Optional[str]

Content of the message.

The content of the message, if present. This will be None if no content is present (e.g. if only an embed was sent).

embeds property #

embeds: Sequence[Embed]

Sequence of embeds in the message.

guild_id property #

guild_id: Snowflake

ID of the guild that this event occurred in.

is_bot property #

is_bot: bool

Return True if the message is from a bot.

is_human property #

is_human: bool

Return True if the message was created by a human.

is_webhook property #

is_webhook: bool

Return True if the message was created by a webhook.

member property #

member: Optional[Member]

Member object of the user that sent the message.

message class-attribute instance-attribute #

message: Message = field()

Message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

get_channel #

get_channel() -> Optional[TextableGuildChannel]

Channel that the message was sent in, if known.

RETURNS DESCRIPTION
Optional[TextableGuildChannel]

The channel that the message was sent in, if known and cached, otherwise, None.

get_guild #

get_guild() -> Optional[GatewayGuild]

Get the cached guild that this event occurred in, if known.

Note

This will require the hikari.intents.Intents.GUILDS intent to be specified on start-up in order to be known.

RETURNS DESCRIPTION
Optional[GatewayGuild]

The guild that this event occurred in, if cached. Otherwise, None instead.

get_member #

get_member() -> Optional[Member]

Get the member that sent this message from the cache if available.

RETURNS DESCRIPTION
Optional[Member]

Cached object of the member that sent the message if found.

GuildMessageDeleteEvent #

Bases: MessageDeleteEvent

Event that is triggered if a message is deleted in a guild.

Note

Due to Discord limitations, most message information is unavailable during deletion events.

app class-attribute instance-attribute #

app: RESTAware = field(metadata={SKIP_DEEP_COPY: True})

App instance for this application.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = field()

ID of the channel that this event concerns.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = field()

ID of the guild that this event occurred in.

message_id class-attribute instance-attribute #

message_id: Snowflake = field()

ID of the message that was deleted.

old_message class-attribute instance-attribute #

old_message: Optional[Message] = field()

Object of the message that was deleted.

Will be None if the message was not found in the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

get_channel #

get_channel() -> Optional[TextableGuildChannel]

Get the cached channel the message were sent in, if known.

RETURNS DESCRIPTION
Optional[TextableGuildChannel]

The channel the messages were sent in, or None if not known/cached.

get_guild #

get_guild() -> Optional[GatewayGuild]

Get the cached guild this event corresponds to, if known.

Note

You will need hikari.intents.Intents.GUILDS enabled to receive this information.

RETURNS DESCRIPTION
GatewayGuild

The gateway guild that this event corresponds to, if known and cached.

GuildMessageUpdateEvent #

Bases: MessageUpdateEvent

Event that is fired when a message is updated in a guild.

Note

Less information will be available here than in the creation event due to Discord limitations.

app property #

app: RESTAware

App instance for this application.

author property #

author: UndefinedOr[User]

User that sent the message.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

author_id property #

author_id: UndefinedOr[Snowflake]

ID of the author that triggered this event.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: UndefinedNoneOr[str]

Content of the message.

The content of the message, if present. This may be None if no content is present (e.g. if only an embed was sent).

If not part of the update, then this will be hikari.undefined.UNDEFINED instead.

embeds property #

Sequence of embeds in the message.

If the embeds were not changed in this event, then this may instead be hikari.undefined.UNDEFINED.

guild_id property #

guild_id: Snowflake

ID of the guild that this event occurred in.

is_bot property #

is_bot: UndefinedOr[bool]

Whether the message is from a bot.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this will return hikari.undefined.UNDEFINED instead.

is_human property #

is_human: UndefinedOr[bool]

Whether the message was created by a human.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

is_webhook property #

is_webhook: UndefinedOr[bool]

Whether the message was created by a webhook.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

member property #

Member that sent the message if provided by the event.

If the message is not in a guild, this will be None.

This will also be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

message class-attribute instance-attribute #

message: PartialMessage = field()

Partial message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

old_message class-attribute instance-attribute #

old_message: Optional[PartialMessage] = field()

The old message object.

This will be None if the message missing from the cache.

shard class-attribute instance-attribute #

shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

get_channel #

get_channel() -> Optional[TextableGuildChannel]

Channel that the message was sent in, if known.

RETURNS DESCRIPTION
Optional[TextableGuildChannel]

The channel that the message was sent in, if known and cached, otherwise, None.

get_guild #

get_guild() -> Optional[GatewayGuild]

Get the cached guild that this event occurred in, if known.

Note

This will require the hikari.intents.Intents.GUILDS intent to be specified on start-up in order to be known.

RETURNS DESCRIPTION
Optional[GatewayGuild]

The guild that this event occurred in, if cached. Otherwise, None instead.

get_member #

get_member() -> Optional[Member]

Get the member that sent this message from the cache if available.

RETURNS DESCRIPTION
Optional[Member]

Cached object of the member that sent the message if found.

MessageCreateEvent #

Bases: MessageEvent, ABC

Event that is fired when a message is created.

app property #

app: RESTAware

App instance for this application.

author property #

author: User

User that sent the message.

author_id property #

author_id: Snowflake

ID of the author of the message this event concerns.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: Optional[str]

Content of the message.

The content of the message, if present. This will be None if no content is present (e.g. if only an embed was sent).

embeds property #

embeds: Sequence[Embed]

Sequence of embeds in the message.

is_bot property #

is_bot: bool

Return True if the message is from a bot.

is_human property #

is_human: bool

Return True if the message was created by a human.

is_webhook property #

is_webhook: bool

Return True if the message was created by a webhook.

message abstractmethod property #

message: Message

Message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

shard abstractmethod property #

shard: GatewayShard

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

MessageDeleteEvent #

Bases: MessageEvent, ABC

Special event that is triggered when a message gets deleted.

Note

Due to Discord limitations, most message information is unavailable during deletion events.

app abstractmethod property #

app: RESTAware

App instance for this application.

channel_id abstractmethod property #

channel_id: Snowflake

ID of the channel that this event concerns.

message_id abstractmethod property #

message_id: Snowflake

ID of the message that was deleted.

old_message abstractmethod property #

old_message: Optional[Message]

Object of the message that was deleted.

Will be None if the message was not found in the cache.

shard abstractmethod property #

shard: GatewayShard

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

MessageEvent #

Bases: ShardEvent, ABC

Any event that concerns manipulation of messages.

app abstractmethod property #

app: RESTAware

App instance for this application.

channel_id abstractmethod property #

channel_id: Snowflake

ID of the channel that this event concerns.

message_id abstractmethod property #

message_id: Snowflake

ID of the message that this event concerns.

shard abstractmethod property #

shard: GatewayShard

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.

MessageUpdateEvent #

Bases: MessageEvent, ABC

Event that is fired when a message is updated.

Note

Less information will be available here than in the creation event due to Discord limitations.

app property #

app: RESTAware

App instance for this application.

author property #

author: UndefinedOr[User]

User that sent the message.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

author_id property #

author_id: UndefinedOr[Snowflake]

ID of the author that triggered this event.

This will be hikari.undefined.UNDEFINED in some cases such as when Discord updates a message with an embed URL preview.

channel_id property #

channel_id: Snowflake

ID of the channel that this event concerns.

content property #

content: UndefinedNoneOr[str]

Content of the message.

The content of the message, if present. This may be None if no content is present (e.g. if only an embed was sent).

If not part of the update, then this will be hikari.undefined.UNDEFINED instead.

embeds property #

Sequence of embeds in the message.

If the embeds were not changed in this event, then this may instead be hikari.undefined.UNDEFINED.

is_bot property #

is_bot: UndefinedOr[bool]

Whether the message is from a bot.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this will return hikari.undefined.UNDEFINED instead.

is_human property #

is_human: UndefinedOr[bool]

Whether the message was created by a human.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

is_webhook property #

is_webhook: UndefinedOr[bool]

Whether the message was created by a webhook.

If the author is not known, due to the update event being caused by Discord adding an embed preview to accompany a URL, then this may return hikari.undefined.UNDEFINED instead.

message abstractmethod property #

message: PartialMessage

Partial message that was sent in the event.

message_id property #

message_id: Snowflake

ID of the message that this event concerns.

shard abstractmethod property #

shard: GatewayShard

Shard that received this event.

bitmask classmethod #

bitmask() -> int

Bitmask for this event.

dispatches classmethod #

dispatches() -> Sequence[Type[Event]]

Sequence of the event classes this event is dispatched as.