Event

Enum Event 

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

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

Received after successful Identify.

§

Resumed

Received after successful Resume.

§

GuildCreate(Box<Guild<'a>>)

Lazy-load for unavailable guild, or guild joined.

§

GuildUpdate(Box<Guild<'a>>)

Guild was updated.

§

GuildDelete(UnavailableGuild)

Guild was deleted or became unavailable.

§

GuildBanAdd(Box<GuildBanEvent<'a>>)

User was banned from guild.

§

GuildBanRemove(Box<GuildBanEvent<'a>>)

User was unbanned from guild.

§

GuildEmojisUpdate(Box<GuildEmojisUpdateEvent<'a>>)

Guild emojis were updated.

§

GuildStickersUpdate(Box<GuildStickersUpdateEvent<'a>>)

Guild stickers were updated.

§

GuildIntegrationsUpdate(Box<GuildIntegrationsUpdateEvent>)

Guild integrations were updated.

§

GuildAuditLogEntryCreate(Box<AuditLogEntry>)

Audit log entry was created.

§

GuildMemberAdd(Box<GuildMemberAddEvent<'a>>)

New member joined guild.

§

GuildMemberRemove(Box<GuildMemberRemoveEvent<'a>>)

Member was removed from guild.

§

GuildMemberUpdate(Box<GuildMemberUpdateEvent<'a>>)

Member was updated.

§

GuildMembersChunk(Box<GuildMembersChunkEvent<'a>>)

Response to Request Guild Members.

§

GuildRoleCreate(Box<GuildRoleEvent<'a>>)

Role was created.

§

GuildRoleUpdate(Box<GuildRoleEvent<'a>>)

Role was updated.

§

GuildRoleDelete(Box<GuildRoleDeleteEvent>)

Role was deleted.

§

ChannelCreate(Box<Channel<'a>>)

Channel was created.

§

ChannelUpdate(Box<Channel<'a>>)

Channel was updated.

§

ChannelDelete(Box<Channel<'a>>)

Channel was deleted.

§

ChannelPinsUpdate(Box<ChannelPinsUpdateEvent>)

Message was pinned/unpinned.

§

ThreadCreate(Box<Channel<'a>>)

Thread was created.

§

ThreadUpdate(Box<Channel<'a>>)

Thread was updated.

§

ThreadDelete(Box<ThreadDeleteEvent>)

Thread was deleted.

§

ThreadListSync(Box<ThreadListSyncEvent<'a>>)

Sent when gaining access to a channel with threads.

§

ThreadMemberUpdate(Box<ThreadMemberUpdateEvent<'a>>)

Current user’s thread member was updated.

§

ThreadMembersUpdate(Box<ThreadMembersUpdateEvent<'a>>)

Users were added/removed from a thread.

§

MessageCreate(Box<Message<'a>>)

Message was created.

§

MessageUpdate(Box<MessageUpdateEvent<'a>>)

Message was updated.

§

MessageDelete(MessageDeleteEvent)

Message was deleted.

§

MessageDeleteBulk(MessageDeleteBulkEvent)

Multiple messages were deleted (bulk).

§

MessageReactionAdd(Box<MessageReactionAddEvent<'a>>)

Reaction was added to a message.

§

MessageReactionRemove(Box<MessageReactionRemoveEvent<'a>>)

Reaction was removed from a message.

§

MessageReactionRemoveAll(Box<MessageReactionRemoveAllEvent>)

All reactions were removed from a message.

§

MessageReactionRemoveEmoji(Box<MessageReactionRemoveEmojiEvent<'a>>)

All reactions for an emoji were removed.

§

InteractionCreate(Box<Interaction<'a>>)

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

§

InviteCreate(Box<InviteCreateEvent<'a>>)

Invite was created.

§

InviteDelete(Box<InviteDeleteEvent<'a>>)

Invite was deleted.

§

StageInstanceCreate(Box<StageInstance>)

Stage instance was created.

§

StageInstanceUpdate(Box<StageInstance>)

Stage instance was updated.

§

StageInstanceDelete(Box<StageInstance>)

Stage instance was deleted.

§

GuildScheduledEventCreate(Box<ScheduledEvent<'a>>)

Scheduled event was created.

§

GuildScheduledEventUpdate(Box<ScheduledEvent<'a>>)

Scheduled event was updated.

§

GuildScheduledEventDelete(Box<ScheduledEvent<'a>>)

Scheduled event was deleted.

§

GuildScheduledEventUserAdd(Box<ScheduledEventUserEvent>)

User subscribed to scheduled event.

§

GuildScheduledEventUserRemove(Box<ScheduledEventUserEvent>)

User unsubscribed from scheduled event.

§

AutoModerationRuleCreate(Box<AutoModRule>)

AutoMod rule was created.

§

AutoModerationRuleUpdate(Box<AutoModRule>)

AutoMod rule was updated.

§

AutoModerationRuleDelete(Box<AutoModRule>)

AutoMod rule was deleted.

§

AutoModerationActionExecution(Box<AutoModActionExecution>)

AutoMod action was executed.

§

IntegrationCreate(Box<Integration<'a>>)

Integration was created.

§

IntegrationUpdate(Box<Integration<'a>>)

Integration was updated.

§

IntegrationDelete(Box<IntegrationDeleteEvent>)

Integration was deleted.

§

WebhooksUpdate(Box<WebhooksUpdateEvent>)

Webhooks were updated in a channel.

§

EntitlementCreate(Box<Entitlement>)

Entitlement was created.

§

EntitlementUpdate(Box<Entitlement>)

Entitlement was updated.

§

EntitlementDelete(Box<Entitlement>)

Entitlement was deleted.

§

SubscriptionCreate(Box<Subscription>)

Subscription was created.

§

SubscriptionUpdate(Box<Subscription>)

Subscription was updated.

§

SubscriptionDelete(Box<Subscription>)

Subscription was deleted.

§

SoundboardSoundCreate(Box<SoundboardSound<'a>>)

Soundboard sound was created in a guild.

§

SoundboardSoundUpdate(Box<SoundboardSound<'a>>)

Soundboard sound was updated in a guild.

§

SoundboardSoundDelete(Box<SoundboardSoundDeleteEvent>)

Soundboard sound was deleted in a guild.

§

SoundboardSoundsUpdate(Box<SoundboardSoundsUpdateEvent<'a>>)

Multiple soundboard sounds were updated.

§

GuildSoundboardSoundsUpdate(Box<GuildSoundboardSoundsUpdateEvent<'a>>)

Guild soundboard sounds were updated.

§

TypingStart(Box<TypingStartEvent<'a>>)

User started typing.

§

PresenceUpdate(Box<PresenceUpdateEvent>)

User’s presence was updated.

§

UserUpdate(Box<User<'a>>)

Current user was updated.

§

VoiceStateUpdate(Box<VoiceStateUpdateEvent<'a>>)

Voice state was updated.

§

VoiceServerUpdate(VoiceServerUpdateEvent)

Voice server information received.

§

VoiceChannelEffectSend(Box<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

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