Skip to main content

DispatchEvent

Enum DispatchEvent 

Source
#[non_exhaustive]
pub enum DispatchEvent {
Show 80 variants Ready(Box<Ready>), RateLimited(Box<RateLimited>), ApplicationCommandPermissionsUpdate(Box<ApplicationCommandPermissionsUpdate>), AutoModerationRuleCreate(Box<AutoModerationRuleCreate>), AutoModerationRuleUpdate(Box<AutoModerationRuleUpdate>), AutoModerationRuleDelete(Box<AutoModerationRuleDelete>), AutoModerationActionExecution(Box<AutoModerationActionExecution>), ChannelCreate(Box<ChannelCreate>), ChannelUpdate(Box<ChannelUpdate>), ChannelDelete(Box<ChannelDelete>), ChannelInfo(Box<ChannelInfo>), ChannelPinsUpdate(Box<ChannelPinsUpdate>), ThreadCreate(Box<ThreadCreate>), ThreadUpdate(Box<ThreadUpdate>), ThreadDelete(Box<ThreadDelete>), ThreadListSync(Box<ThreadListSync>), ThreadMemberUpdate(Box<ThreadMemberUpdate>), ThreadMembersUpdate(Box<ThreadMembersUpdate>), EntitlementCreate(Box<EntitlementCreate>), EntitlementUpdate(Box<EntitlementUpdate>), EntitlementDelete(Box<EntitlementDelete>), GuildCreate(Box<GuildCreate>), GuildUpdate(Box<GuildUpdate>), GuildDelete(GuildDelete), GuildAuditLogEntryCreate(Box<GuildAuditLogEntryCreate>), GuildBanAdd(Box<GuildBanAdd>), GuildBanRemove(Box<GuildBanRemove>), GuildEmojisUpdate(Box<GuildEmojisUpdate>), GuildStickersUpdate(Box<GuildStickersUpdate>), GuildIntegrationsUpdate(GuildIntegrationsUpdate), GuildMemberAdd(Box<GuildMemberAdd>), GuildMemberRemove(Box<GuildMemberRemove>), GuildMemberUpdate(Box<GuildMemberUpdate>), GuildMembersChunk(Box<GuildMembersChunk>), GuildRoleCreate(Box<GuildRoleCreate>), GuildRoleUpdate(Box<GuildRoleUpdate>), GuildRoleDelete(GuildRoleDelete), GuildScheduledEventCreate(Box<GuildScheduledEventCreate>), GuildScheduledEventUpdate(Box<GuildScheduledEventUpdate>), GuildScheduledEventDelete(Box<GuildScheduledEventDelete>), GuildScheduledEventUserAdd(GuildScheduledEventUserAdd), GuildScheduledEventUserRemove(GuildScheduledEventUserRemove), GuildSoundboardSoundCreate(Box<GuildSoundboardSoundCreate>), GuildSoundboardSoundUpdate(Box<GuildSoundboardSoundUpdate>), GuildSoundboardSoundDelete(GuildSoundboardSoundDelete), GuildSoundboardSoundsUpdate(Box<GuildSoundboardSoundsUpdate>), SoundboardSounds(Box<SoundboardSounds>), IntegrationCreate(Box<IntegrationCreate>), IntegrationUpdate(Box<IntegrationUpdate>), IntegrationDelete(IntegrationDelete), InteractionCreate(Box<InteractionCreate>), InviteCreate(Box<InviteCreate>), InviteDelete(Box<InviteDelete>), MessageCreate(Box<MessageCreate>), MessageUpdate(Box<MessageUpdate>), MessageDelete(Box<MessageDelete>), MessageDeleteBulk(Box<MessageDeleteBulk>), MessageReactionAdd(Box<MessageReactionAdd>), MessageReactionRemove(Box<MessageReactionRemove>), MessageReactionRemoveAll(MessageReactionRemoveAll), MessageReactionRemoveEmoji(Box<MessageReactionRemoveEmoji>), MessagePollVoteAdd(Box<MessagePollVoteAdd>), MessagePollVoteRemove(Box<MessagePollVoteRemove>), PresenceUpdate(Box<PresenceUpdate>), StageInstanceCreate(Box<StageInstanceCreate>), StageInstanceUpdate(Box<StageInstanceUpdate>), StageInstanceDelete(Box<StageInstanceDelete>), SubscriptionCreate(Box<SubscriptionCreate>), SubscriptionUpdate(Box<SubscriptionUpdate>), SubscriptionDelete(Box<SubscriptionDelete>), TypingStart(Box<TypingStart>), UserUpdate(Box<UserUpdate>), VoiceChannelEffectSend(Box<VoiceChannelEffectSend>), VoiceChannelStartTimeUpdate(Box<VoiceChannelStartTimeUpdate>), VoiceChannelStatusUpdate(Box<VoiceChannelStatusUpdate>), VoiceStateUpdate(Box<VoiceStateUpdate>), VoiceServerUpdate(Box<VoiceServerUpdate>), WebhooksUpdate(WebhooksUpdate), Resumed, Unknown(CompactString),
}
Expand description

The event carried by a GatewayEvent::Dispatch: every documented dispatch event, with its own payload type (D-073) from payload.

Large payloads are boxed to keep this enum small; small Copy payloads are inline. Events this version does not know are skipped efficiently (validated, not stored) and reported as Unknown with their name.

discord.js counterpart: GatewayDispatchPayload (discord-api-types).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Ready(Box<Ready>)

READY: the session was established.

§

RateLimited(Box<RateLimited>)

RATE_LIMITED: a gateway command was rate limited.

§

ApplicationCommandPermissionsUpdate(Box<ApplicationCommandPermissionsUpdate>)

APPLICATION_COMMAND_PERMISSIONS_UPDATE: a command’s permissions were updated.

§

AutoModerationRuleCreate(Box<AutoModerationRuleCreate>)

AUTO_MODERATION_RULE_CREATE: an auto moderation rule was created.

§

AutoModerationRuleUpdate(Box<AutoModerationRuleUpdate>)

AUTO_MODERATION_RULE_UPDATE: an auto moderation rule was updated.

§

AutoModerationRuleDelete(Box<AutoModerationRuleDelete>)

AUTO_MODERATION_RULE_DELETE: an auto moderation rule was deleted.

§

AutoModerationActionExecution(Box<AutoModerationActionExecution>)

AUTO_MODERATION_ACTION_EXECUTION: an auto moderation action ran.

§

ChannelCreate(Box<ChannelCreate>)

CHANNEL_CREATE: a guild channel was created.

§

ChannelUpdate(Box<ChannelUpdate>)

CHANNEL_UPDATE: a channel was updated.

§

ChannelDelete(Box<ChannelDelete>)

CHANNEL_DELETE: a channel was deleted.

§

ChannelInfo(Box<ChannelInfo>)

CHANNEL_INFO: ephemeral channel data (answer to a channel info request).

§

ChannelPinsUpdate(Box<ChannelPinsUpdate>)

CHANNEL_PINS_UPDATE: a message was pinned or unpinned.

§

ThreadCreate(Box<ThreadCreate>)

THREAD_CREATE: a thread was created or the bot was added to one.

§

ThreadUpdate(Box<ThreadUpdate>)

THREAD_UPDATE: a thread was updated.

§

ThreadDelete(Box<ThreadDelete>)

THREAD_DELETE: a thread was deleted.

§

ThreadListSync(Box<ThreadListSync>)

THREAD_LIST_SYNC: the active threads of channels the bot gained access to.

§

ThreadMemberUpdate(Box<ThreadMemberUpdate>)

THREAD_MEMBER_UPDATE: the bot’s thread member was updated.

§

ThreadMembersUpdate(Box<ThreadMembersUpdate>)

THREAD_MEMBERS_UPDATE: users were added to or removed from a thread.

§

EntitlementCreate(Box<EntitlementCreate>)

ENTITLEMENT_CREATE: an entitlement was created.

§

EntitlementUpdate(Box<EntitlementUpdate>)

ENTITLEMENT_UPDATE: an entitlement was updated or ended.

§

EntitlementDelete(Box<EntitlementDelete>)

ENTITLEMENT_DELETE: an entitlement was deleted.

§

GuildCreate(Box<GuildCreate>)

GUILD_CREATE: a guild was loaded, became available or was joined.

§

GuildUpdate(Box<GuildUpdate>)

GUILD_UPDATE: a guild was updated.

§

GuildDelete(GuildDelete)

GUILD_DELETE: a guild became unavailable or the bot left it.

§

GuildAuditLogEntryCreate(Box<GuildAuditLogEntryCreate>)

GUILD_AUDIT_LOG_ENTRY_CREATE: an audit log entry was created.

§

GuildBanAdd(Box<GuildBanAdd>)

GUILD_BAN_ADD: a user was banned.

§

GuildBanRemove(Box<GuildBanRemove>)

GUILD_BAN_REMOVE: a user was unbanned.

§

GuildEmojisUpdate(Box<GuildEmojisUpdate>)

GUILD_EMOJIS_UPDATE: a guild’s emojis changed.

§

GuildStickersUpdate(Box<GuildStickersUpdate>)

GUILD_STICKERS_UPDATE: a guild’s stickers changed.

§

GuildIntegrationsUpdate(GuildIntegrationsUpdate)

GUILD_INTEGRATIONS_UPDATE: a guild’s integrations changed.

§

GuildMemberAdd(Box<GuildMemberAdd>)

GUILD_MEMBER_ADD: a user joined a guild.

§

GuildMemberRemove(Box<GuildMemberRemove>)

GUILD_MEMBER_REMOVE: a user left or was removed from a guild.

§

GuildMemberUpdate(Box<GuildMemberUpdate>)

GUILD_MEMBER_UPDATE: a member was updated.

§

GuildMembersChunk(Box<GuildMembersChunk>)

GUILD_MEMBERS_CHUNK: members requested with a guild members request.

§

GuildRoleCreate(Box<GuildRoleCreate>)

GUILD_ROLE_CREATE: a role was created.

§

GuildRoleUpdate(Box<GuildRoleUpdate>)

GUILD_ROLE_UPDATE: a role was updated.

§

GuildRoleDelete(GuildRoleDelete)

GUILD_ROLE_DELETE: a role was deleted.

§

GuildScheduledEventCreate(Box<GuildScheduledEventCreate>)

GUILD_SCHEDULED_EVENT_CREATE: a scheduled event was created.

§

GuildScheduledEventUpdate(Box<GuildScheduledEventUpdate>)

GUILD_SCHEDULED_EVENT_UPDATE: a scheduled event was updated.

§

GuildScheduledEventDelete(Box<GuildScheduledEventDelete>)

GUILD_SCHEDULED_EVENT_DELETE: a scheduled event was deleted.

§

GuildScheduledEventUserAdd(GuildScheduledEventUserAdd)

GUILD_SCHEDULED_EVENT_USER_ADD: a user subscribed to a scheduled event.

§

GuildScheduledEventUserRemove(GuildScheduledEventUserRemove)

GUILD_SCHEDULED_EVENT_USER_REMOVE: a user unsubscribed from a scheduled event.

§

GuildSoundboardSoundCreate(Box<GuildSoundboardSoundCreate>)

GUILD_SOUNDBOARD_SOUND_CREATE: a soundboard sound was created.

§

GuildSoundboardSoundUpdate(Box<GuildSoundboardSoundUpdate>)

GUILD_SOUNDBOARD_SOUND_UPDATE: a soundboard sound was updated.

§

GuildSoundboardSoundDelete(GuildSoundboardSoundDelete)

GUILD_SOUNDBOARD_SOUND_DELETE: a soundboard sound was deleted.

§

GuildSoundboardSoundsUpdate(Box<GuildSoundboardSoundsUpdate>)

GUILD_SOUNDBOARD_SOUNDS_UPDATE: several soundboard sounds were updated.

§

SoundboardSounds(Box<SoundboardSounds>)

SOUNDBOARD_SOUNDS: a guild’s soundboard sounds (answer to a soundboard sounds request).

§

IntegrationCreate(Box<IntegrationCreate>)

INTEGRATION_CREATE: an integration was created.

§

IntegrationUpdate(Box<IntegrationUpdate>)

INTEGRATION_UPDATE: an integration was updated.

§

IntegrationDelete(IntegrationDelete)

INTEGRATION_DELETE: an integration was deleted.

§

InteractionCreate(Box<InteractionCreate>)

INTERACTION_CREATE: a user used a command, component or modal.

§

InviteCreate(Box<InviteCreate>)

INVITE_CREATE: an invite was created.

§

InviteDelete(Box<InviteDelete>)

INVITE_DELETE: an invite was deleted.

§

MessageCreate(Box<MessageCreate>)

MESSAGE_CREATE: a message was sent.

§

MessageUpdate(Box<MessageUpdate>)

MESSAGE_UPDATE: a message was edited.

§

MessageDelete(Box<MessageDelete>)

MESSAGE_DELETE: a message was deleted.

§

MessageDeleteBulk(Box<MessageDeleteBulk>)

MESSAGE_DELETE_BULK: several messages were deleted.

§

MessageReactionAdd(Box<MessageReactionAdd>)

MESSAGE_REACTION_ADD: a user reacted to a message.

§

MessageReactionRemove(Box<MessageReactionRemove>)

MESSAGE_REACTION_REMOVE: a reaction was removed.

§

MessageReactionRemoveAll(MessageReactionRemoveAll)

MESSAGE_REACTION_REMOVE_ALL: all reactions were removed from a message.

§

MessageReactionRemoveEmoji(Box<MessageReactionRemoveEmoji>)

MESSAGE_REACTION_REMOVE_EMOJI: all reactions with one emoji were removed.

§

MessagePollVoteAdd(Box<MessagePollVoteAdd>)

MESSAGE_POLL_VOTE_ADD: a user voted on a poll.

§

MessagePollVoteRemove(Box<MessagePollVoteRemove>)

MESSAGE_POLL_VOTE_REMOVE: a user removed a poll vote.

§

PresenceUpdate(Box<PresenceUpdate>)

PRESENCE_UPDATE: a user’s presence or user data changed.

§

StageInstanceCreate(Box<StageInstanceCreate>)

STAGE_INSTANCE_CREATE: a stage went live.

§

StageInstanceUpdate(Box<StageInstanceUpdate>)

STAGE_INSTANCE_UPDATE: a stage instance was updated.

§

StageInstanceDelete(Box<StageInstanceDelete>)

STAGE_INSTANCE_DELETE: a stage ended.

§

SubscriptionCreate(Box<SubscriptionCreate>)

SUBSCRIPTION_CREATE: an app subscription was created.

§

SubscriptionUpdate(Box<SubscriptionUpdate>)

SUBSCRIPTION_UPDATE: an app subscription was updated.

§

SubscriptionDelete(Box<SubscriptionDelete>)

SUBSCRIPTION_DELETE: an app subscription was deleted.

§

TypingStart(Box<TypingStart>)

TYPING_START: a user started typing.

§

UserUpdate(Box<UserUpdate>)

USER_UPDATE: the bot’s user changed.

§

VoiceChannelEffectSend(Box<VoiceChannelEffectSend>)

VOICE_CHANNEL_EFFECT_SEND: someone sent an effect in the bot’s voice channel.

§

VoiceChannelStartTimeUpdate(Box<VoiceChannelStartTimeUpdate>)

VOICE_CHANNEL_START_TIME_UPDATE: a voice channel’s start time changed.

§

VoiceChannelStatusUpdate(Box<VoiceChannelStatusUpdate>)

VOICE_CHANNEL_STATUS_UPDATE: a voice channel’s status changed.

§

VoiceStateUpdate(Box<VoiceStateUpdate>)

VOICE_STATE_UPDATE: someone joined, left or moved between voice channels.

§

VoiceServerUpdate(Box<VoiceServerUpdate>)

VOICE_SERVER_UPDATE: where to connect for voice.

§

WebhooksUpdate(WebhooksUpdate)

WEBHOOKS_UPDATE: a channel’s webhooks changed.

§

Resumed

RESUMED: a resume completed and all missed events were replayed.

§

Unknown(CompactString)

An event this version of the library does not decode, with its name.

Implementations§

Source§

impl DispatchEvent

Source

pub fn name(&self) -> &str

Returns the event name as sent by Discord, such as "MESSAGE_CREATE".

discord.js counterpart: GatewayDispatchEvents (discord-api-types).

Trait Implementations§

Source§

impl Clone for DispatchEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DispatchEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DispatchEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DispatchEvent

Serializes the event’s data (the d field of the payload): the payload type’s own JSON shape; null for Resumed and Unknown events (whose data is not kept).

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DispatchEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.