Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event<'a> {
Show 73 variants Ready(Arc<ReadyEventData<'a>>), Resumed, GuildCreate(Arc<Guild<'a>>), GuildUpdate(Arc<Guild<'a>>), GuildDelete(UnavailableGuild), GuildBanAdd(Arc<GuildBanEvent<'a>>), GuildBanRemove(Arc<GuildBanEvent<'a>>), GuildEmojisUpdate(Arc<GuildEmojisUpdateEvent<'a>>), GuildStickersUpdate(Arc<GuildStickersUpdateEvent<'a>>), GuildIntegrationsUpdate(Arc<GuildIntegrationsUpdateEvent>), GuildAuditLogEntryCreate(Arc<AuditLogEntry>), GuildMemberAdd(Arc<GuildMemberAddEvent<'a>>), GuildMemberRemove(Arc<GuildMemberRemoveEvent<'a>>), GuildMemberUpdate(Arc<GuildMemberUpdateEvent<'a>>), GuildMembersChunk(Arc<GuildMembersChunkEvent<'a>>), GuildRoleCreate(Arc<GuildRoleEvent<'a>>), GuildRoleUpdate(Arc<GuildRoleEvent<'a>>), GuildRoleDelete(Arc<GuildRoleDeleteEvent>), ChannelCreate(Arc<Channel<'a>>), ChannelUpdate(Arc<Channel<'a>>), ChannelDelete(Arc<Channel<'a>>), ChannelPinsUpdate(Arc<ChannelPinsUpdateEvent>), ThreadCreate(Arc<Channel<'a>>), ThreadUpdate(Arc<Channel<'a>>), ThreadDelete(Arc<ThreadDeleteEvent>), ThreadListSync(Arc<ThreadListSyncEvent<'a>>), ThreadMemberUpdate(Arc<ThreadMemberUpdateEvent<'a>>), ThreadMembersUpdate(Arc<ThreadMembersUpdateEvent<'a>>), MessageCreate(Arc<Message<'a>>), MessageUpdate(Arc<MessageUpdateEvent<'a>>), MessageDelete(MessageDeleteEvent), MessageDeleteBulk(MessageDeleteBulkEvent), MessageReactionAdd(Arc<MessageReactionAddEvent<'a>>), MessageReactionRemove(Arc<MessageReactionRemoveEvent<'a>>), MessageReactionRemoveAll(Arc<MessageReactionRemoveAllEvent>), MessageReactionRemoveEmoji(Arc<MessageReactionRemoveEmojiEvent<'a>>), InteractionCreate(Arc<Interaction<'a>>), InviteCreate(Arc<InviteCreateEvent<'a>>), InviteDelete(Arc<InviteDeleteEvent<'a>>), StageInstanceCreate(Arc<StageInstance>), StageInstanceUpdate(Arc<StageInstance>), StageInstanceDelete(Arc<StageInstance>), GuildScheduledEventCreate(Arc<ScheduledEvent<'a>>), GuildScheduledEventUpdate(Arc<ScheduledEvent<'a>>), GuildScheduledEventDelete(Arc<ScheduledEvent<'a>>), GuildScheduledEventUserAdd(Arc<ScheduledEventUserEvent>), GuildScheduledEventUserRemove(Arc<ScheduledEventUserEvent>), AutoModerationRuleCreate(Arc<AutoModRule>), AutoModerationRuleUpdate(Arc<AutoModRule>), AutoModerationRuleDelete(Arc<AutoModRule>), AutoModerationActionExecution(Arc<AutoModActionExecution>), IntegrationCreate(Arc<Integration<'a>>), IntegrationUpdate(Arc<Integration<'a>>), IntegrationDelete(Arc<IntegrationDeleteEvent>), WebhooksUpdate(Arc<WebhooksUpdateEvent>), EntitlementCreate(Arc<Entitlement>), EntitlementUpdate(Arc<Entitlement>), EntitlementDelete(Arc<Entitlement>), SubscriptionCreate(Arc<Subscription>), SubscriptionUpdate(Arc<Subscription>), SubscriptionDelete(Arc<Subscription>), SoundboardSoundCreate(Arc<SoundboardSound<'a>>), SoundboardSoundUpdate(Arc<SoundboardSound<'a>>), SoundboardSoundDelete(Arc<SoundboardSoundDeleteEvent>), SoundboardSoundsUpdate(Arc<SoundboardSoundsUpdateEvent<'a>>), GuildSoundboardSoundsUpdate(Arc<GuildSoundboardSoundsUpdateEvent<'a>>), TypingStart(Arc<TypingStartEvent<'a>>), PresenceUpdate(Arc<PresenceUpdateEvent>), UserUpdate(Arc<User<'a>>), VoiceStateUpdate(Arc<VoiceStateUpdateEvent<'a>>), VoiceServerUpdate(VoiceServerUpdateEvent), VoiceChannelEffectSend(Arc<VoiceChannelEffectSendEvent<'a>>), Unknown { name: String, data: Value, },
}
Expand description

Parsed Gateway event ready for handler dispatch.

Events are parsed from Dispatch payloads (opcode 0). Each variant corresponds to a Discord Gateway event type.

§Performance

Events are wrapped in Arc to allow cheap cloning when dispatching to multiple handlers or storing in cache.

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(Arc<ReadyEventData<'a>>)

Received after successful Identify.

§

Resumed

Received after successful Resume.

§

GuildCreate(Arc<Guild<'a>>)

Lazy-load for unavailable guild, or guild joined.

§

GuildUpdate(Arc<Guild<'a>>)

Guild was updated.

§

GuildDelete(UnavailableGuild)

Guild was deleted or became unavailable.

§

GuildBanAdd(Arc<GuildBanEvent<'a>>)

User was banned from guild.

§

GuildBanRemove(Arc<GuildBanEvent<'a>>)

User was unbanned from guild.

§

GuildEmojisUpdate(Arc<GuildEmojisUpdateEvent<'a>>)

Guild emojis were updated.

§

GuildStickersUpdate(Arc<GuildStickersUpdateEvent<'a>>)

Guild stickers were updated.

§

GuildIntegrationsUpdate(Arc<GuildIntegrationsUpdateEvent>)

Guild integrations were updated.

§

GuildAuditLogEntryCreate(Arc<AuditLogEntry>)

Audit log entry was created.

§

GuildMemberAdd(Arc<GuildMemberAddEvent<'a>>)

New member joined guild.

§

GuildMemberRemove(Arc<GuildMemberRemoveEvent<'a>>)

Member was removed from guild.

§

GuildMemberUpdate(Arc<GuildMemberUpdateEvent<'a>>)

Member was updated.

§

GuildMembersChunk(Arc<GuildMembersChunkEvent<'a>>)

Response to Request Guild Members.

§

GuildRoleCreate(Arc<GuildRoleEvent<'a>>)

Role was created.

§

GuildRoleUpdate(Arc<GuildRoleEvent<'a>>)

Role was updated.

§

GuildRoleDelete(Arc<GuildRoleDeleteEvent>)

Role was deleted.

§

ChannelCreate(Arc<Channel<'a>>)

Channel was created.

§

ChannelUpdate(Arc<Channel<'a>>)

Channel was updated.

§

ChannelDelete(Arc<Channel<'a>>)

Channel was deleted.

§

ChannelPinsUpdate(Arc<ChannelPinsUpdateEvent>)

Message was pinned/unpinned.

§

ThreadCreate(Arc<Channel<'a>>)

Thread was created.

§

ThreadUpdate(Arc<Channel<'a>>)

Thread was updated.

§

ThreadDelete(Arc<ThreadDeleteEvent>)

Thread was deleted.

§

ThreadListSync(Arc<ThreadListSyncEvent<'a>>)

Sent when gaining access to a channel with threads.

§

ThreadMemberUpdate(Arc<ThreadMemberUpdateEvent<'a>>)

Current user’s thread member was updated.

§

ThreadMembersUpdate(Arc<ThreadMembersUpdateEvent<'a>>)

Users were added/removed from a thread.

§

MessageCreate(Arc<Message<'a>>)

Message was created.

§

MessageUpdate(Arc<MessageUpdateEvent<'a>>)

Message was updated.

§

MessageDelete(MessageDeleteEvent)

Message was deleted.

§

MessageDeleteBulk(MessageDeleteBulkEvent)

Multiple messages were deleted (bulk).

§

MessageReactionAdd(Arc<MessageReactionAddEvent<'a>>)

Reaction was added to a message.

§

MessageReactionRemove(Arc<MessageReactionRemoveEvent<'a>>)

Reaction was removed from a message.

§

MessageReactionRemoveAll(Arc<MessageReactionRemoveAllEvent>)

All reactions were removed from a message.

§

MessageReactionRemoveEmoji(Arc<MessageReactionRemoveEmojiEvent<'a>>)

All reactions for an emoji were removed.

§

InteractionCreate(Arc<Interaction<'a>>)

An interaction was created (slash command, button, modal, etc.).

§

InviteCreate(Arc<InviteCreateEvent<'a>>)

Invite was created.

§

InviteDelete(Arc<InviteDeleteEvent<'a>>)

Invite was deleted.

§

StageInstanceCreate(Arc<StageInstance>)

Stage instance was created.

§

StageInstanceUpdate(Arc<StageInstance>)

Stage instance was updated.

§

StageInstanceDelete(Arc<StageInstance>)

Stage instance was deleted.

§

GuildScheduledEventCreate(Arc<ScheduledEvent<'a>>)

Scheduled event was created.

§

GuildScheduledEventUpdate(Arc<ScheduledEvent<'a>>)

Scheduled event was updated.

§

GuildScheduledEventDelete(Arc<ScheduledEvent<'a>>)

Scheduled event was deleted.

§

GuildScheduledEventUserAdd(Arc<ScheduledEventUserEvent>)

User subscribed to scheduled event.

§

GuildScheduledEventUserRemove(Arc<ScheduledEventUserEvent>)

User unsubscribed from scheduled event.

§

AutoModerationRuleCreate(Arc<AutoModRule>)

AutoMod rule was created.

§

AutoModerationRuleUpdate(Arc<AutoModRule>)

AutoMod rule was updated.

§

AutoModerationRuleDelete(Arc<AutoModRule>)

AutoMod rule was deleted.

§

AutoModerationActionExecution(Arc<AutoModActionExecution>)

AutoMod action was executed.

§

IntegrationCreate(Arc<Integration<'a>>)

Integration was created.

§

IntegrationUpdate(Arc<Integration<'a>>)

Integration was updated.

§

IntegrationDelete(Arc<IntegrationDeleteEvent>)

Integration was deleted.

§

WebhooksUpdate(Arc<WebhooksUpdateEvent>)

Webhooks were updated in a channel.

§

EntitlementCreate(Arc<Entitlement>)

Entitlement was created.

§

EntitlementUpdate(Arc<Entitlement>)

Entitlement was updated.

§

EntitlementDelete(Arc<Entitlement>)

Entitlement was deleted.

§

SubscriptionCreate(Arc<Subscription>)

Subscription was created.

§

SubscriptionUpdate(Arc<Subscription>)

Subscription was updated.

§

SubscriptionDelete(Arc<Subscription>)

Subscription was deleted.

§

SoundboardSoundCreate(Arc<SoundboardSound<'a>>)

Soundboard sound was created in a guild.

§

SoundboardSoundUpdate(Arc<SoundboardSound<'a>>)

Soundboard sound was updated in a guild.

§

SoundboardSoundDelete(Arc<SoundboardSoundDeleteEvent>)

Soundboard sound was deleted in a guild.

§

SoundboardSoundsUpdate(Arc<SoundboardSoundsUpdateEvent<'a>>)

Multiple soundboard sounds were updated.

§

GuildSoundboardSoundsUpdate(Arc<GuildSoundboardSoundsUpdateEvent<'a>>)

Guild soundboard sounds were updated.

§

TypingStart(Arc<TypingStartEvent<'a>>)

User started typing.

§

PresenceUpdate(Arc<PresenceUpdateEvent>)

User’s presence was updated.

§

UserUpdate(Arc<User<'a>>)

Current user was updated.

§

VoiceStateUpdate(Arc<VoiceStateUpdateEvent<'a>>)

Voice state was updated.

§

VoiceServerUpdate(VoiceServerUpdateEvent)

Voice server information received.

§

VoiceChannelEffectSend(Arc<VoiceChannelEffectSendEvent<'a>>)

Voice channel effect was sent.

§

Unknown

Unknown event type - contains raw JSON for custom handling.

Fields

§name: String

The event name.

§data: Value

Raw JSON data.

Trait Implementations§

Source§

impl<'a> Clone for Event<'a>

Source§

fn clone(&self) -> Event<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Event<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Event<'a>

§

impl<'a> RefUnwindSafe for Event<'a>

§

impl<'a> Send for Event<'a>

§

impl<'a> Sync for Event<'a>

§

impl<'a> Unpin for Event<'a>

§

impl<'a> UnwindSafe for Event<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more