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.
content
property
#
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).
message
class-attribute
instance-attribute
#
Message that was sent in the event.
shard
class-attribute
instance-attribute
#
shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})
Shard that received this event.
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 instance for this application.
channel_id
class-attribute
instance-attribute
#
ID of the channel that this event concerns.
message_id
class-attribute
instance-attribute
#
ID of the message that was deleted.
old_message
class-attribute
instance-attribute
#
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.
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.
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.
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
#
embeds: UndefinedOr[Sequence[Embed]]
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.
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.
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 instance for this application.
channel_id
class-attribute
instance-attribute
#
ID of the channel that this event concerns.
guild_id
class-attribute
instance-attribute
#
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
#
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.
dispatches
classmethod
#
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 |
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.
content
property
#
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).
message
class-attribute
instance-attribute
#
Message that was sent in the event.
shard
class-attribute
instance-attribute
#
shard: GatewayShard = field(metadata={SKIP_DEEP_COPY: True})
Shard that received this event.
dispatches
classmethod
#
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, |
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,
|
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 instance for this application.
channel_id
class-attribute
instance-attribute
#
ID of the channel that this event concerns.
guild_id
class-attribute
instance-attribute
#
ID of the guild that this event occurred in.
message_id
class-attribute
instance-attribute
#
ID of the message that was deleted.
old_message
class-attribute
instance-attribute
#
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.
dispatches
classmethod
#
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 |
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.
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.
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
#
embeds: UndefinedOr[Sequence[Embed]]
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.
member
property
#
member: UndefinedNoneOr[Member]
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.
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.
dispatches
classmethod
#
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, |
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,
|
MessageCreateEvent
#
Bases: MessageEvent
, ABC
Event that is fired when a message is created.
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.
MessageEvent
#
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.
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.
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
#
embeds: UndefinedOr[Sequence[Embed]]
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.