hikari.events.message_events#
Events that fire if messages are sent/updated/deleted.
Module Contents#
- class hikari.events.message_events.DMMessageCreateEvent[source]#
Bases:
MessageCreateEvent
Event that is fired when a message is created within a DM.
This contains the full message in the internal
message
attribute.
- class hikari.events.message_events.DMMessageDeleteEvent[source]#
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.
- class hikari.events.message_events.DMMessageUpdateEvent[source]#
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.
- old_message: hikari.messages.PartialMessage | None[source]#
The old message object.
This will be
None
if the message missing from the cache.
- class hikari.events.message_events.GuildBulkMessageDeleteEvent[source]#
Bases:
hikari.events.shard_events.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.
- channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel that this event concerns.
- guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event occurred in.
- message_ids: AbstractSet[hikari.snowflakes.Snowflake][source]#
Set of message IDs that were bulk deleted.
- old_messages: Mapping[hikari.snowflakes.Snowflake, hikari.messages.Message][source]#
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.
- get_channel()[source]#
Get the cached channel the messages were sent in, if known.
- Returns:
typing.Optional
[hikari.channels.TextableGuildChannel
]The channel the messages were sent in, or
None
if not known/cached.
- get_guild()[source]#
Get the cached guild this event corresponds to, if known.
Note
You will need
hikari.intents.Intents.GUILDS
enabled to receive this information.- Returns:
hikari.guilds.GatewayGuild
The gateway guild that this event corresponds to, if known and cached.
- class hikari.events.message_events.GuildMessageCreateEvent[source]#
Bases:
MessageCreateEvent
Event that is fired when a message is created within a guild.
This contains the full message in the internal
message
attribute.- property author: hikari.users.User[source]#
User object of the user that sent the message.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event occurred in.
- property member: hikari.guilds.Member | None[source]#
Member object of the user that sent the message.
- get_channel()[source]#
Channel that the message was sent in, if known.
- Returns:
typing.Optional
[hikari.channels.TextableGuildChannel
]The channel that the message was sent in, if known and cached, otherwise,
None
.
- get_guild()[source]#
Get the cached guild that this event occurred in, if known.
Note
This will require the
GUILDS
intent to be specified on start-up in order to be known.- Returns:
typing.Optional
[hikari.guilds.GatewayGuild
]The guild that this event occurred in, if cached. Otherwise,
None
instead.
- get_member()[source]#
Get the member that sent this message from the cache if available.
- Returns:
typing.Optional
[hikari.guilds.Member
]Cached object of the member that sent the message if found.
- class hikari.events.message_events.GuildMessageDeleteEvent[source]#
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.
- guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event occurred in.
- get_channel()[source]#
Get the cached channel the message were sent in, if known.
- Returns:
typing.Optional
[hikari.channels.TextableGuildChannel
]The channel the messages were sent in, or
None
if not known/cached.
- get_guild()[source]#
Get the cached guild this event corresponds to, if known.
Note
You will need
hikari.intents.Intents.GUILDS
enabled to receive this information.- Returns:
hikari.guilds.GatewayGuild
The gateway guild that this event corresponds to, if known and cached.
- class hikari.events.message_events.GuildMessageUpdateEvent[source]#
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.
- property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild that this event occurred in.
- property member: hikari.undefined.UndefinedNoneOr[hikari.guilds.Member][source]#
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.
- old_message: hikari.messages.PartialMessage | None[source]#
The old message object.
This will be
None
if the message missing from the cache.
- get_channel()[source]#
Channel that the message was sent in, if known.
- Returns:
typing.Optional
[hikari.channels.TextableGuildChannel
]The channel that the message was sent in, if known and cached, otherwise,
None
.
- get_guild()[source]#
Get the cached guild that this event occurred in, if known.
Note
This will require the
GUILDS
intent to be specified on start-up in order to be known.- Returns:
typing.Optional
[hikari.guilds.GatewayGuild
]The guild that this event occurred in, if cached. Otherwise,
None
instead.
- get_member()[source]#
Get the member that sent this message from the cache if available.
- Returns:
typing.Optional
[hikari.guilds.Member
]Cached object of the member that sent the message if found.
- class hikari.events.message_events.MessageCreateEvent[source]#
Bases:
MessageEvent
,abc.ABC
Event that is fired when a message is created.
- property author: hikari.users.User[source]#
User that sent the message.
- property author_id: hikari.snowflakes.Snowflake[source]#
ID of the author of the message this event concerns.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel that this event concerns.
- property content: str | None[source]#
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).
- property embeds: Sequence[hikari.embeds.Embed][source]#
Sequence of embeds in the message.
- abstract property message: hikari.messages.Message[source]#
Message that was sent in the event.
- property message_id: hikari.snowflakes.Snowflake[source]#
ID of the message that this event concerns.
- class hikari.events.message_events.MessageDeleteEvent[source]#
Bases:
MessageEvent
,abc.ABC
Special event that is triggered when a message gets deleted.
Note
Due to Discord limitations, most message information is unavailable during deletion events.
- abstract property message_id: hikari.snowflakes.Snowflake[source]#
ID of the message that was deleted.
- abstract property old_message: hikari.messages.Message | None[source]#
Object of the message that was deleted.
Will be
None
if the message was not found in the cache.
- class hikari.events.message_events.MessageEvent[source]#
Bases:
hikari.events.shard_events.ShardEvent
,abc.ABC
Any event that concerns manipulation of messages.
- abstract property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel that this event concerns.
- abstract property message_id: hikari.snowflakes.Snowflake[source]#
ID of the message that this event concerns.
- class hikari.events.message_events.MessageUpdateEvent[source]#
Bases:
MessageEvent
,abc.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.
- property author: hikari.undefined.UndefinedOr[hikari.users.User][source]#
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.
- property author_id: hikari.undefined.UndefinedOr[hikari.snowflakes.Snowflake][source]#
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.
- property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the channel that this event concerns.
- property content: hikari.undefined.UndefinedNoneOr[str][source]#
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.
- property embeds: hikari.undefined.UndefinedOr[Sequence[hikari.embeds.Embed]][source]#
Sequence of embeds in the message.
If the embeds were not changed in this event, then this may instead be
hikari.undefined.UNDEFINED
.
- property is_bot: hikari.undefined.UndefinedOr[bool][source]#
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.
- property is_human: hikari.undefined.UndefinedOr[bool][source]#
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.
- property is_webhook: hikari.undefined.UndefinedOr[bool][source]#
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.
- abstract property message: hikari.messages.PartialMessage[source]#
Partial message that was sent in the event.
- property message_id: hikari.snowflakes.Snowflake[source]#
ID of the message that this event concerns.