twilight_model::gateway::event

Enum Event

Source
pub enum Event {
Show 73 variants AutoModerationActionExecution(AutoModerationActionExecution), AutoModerationRuleCreate(AutoModerationRuleCreate), AutoModerationRuleDelete(AutoModerationRuleDelete), AutoModerationRuleUpdate(AutoModerationRuleUpdate), BanAdd(BanAdd), BanRemove(BanRemove), ChannelCreate(Box<ChannelCreate>), ChannelDelete(Box<ChannelDelete>), ChannelPinsUpdate(ChannelPinsUpdate), ChannelUpdate(Box<ChannelUpdate>), CommandPermissionsUpdate(CommandPermissionsUpdate), EntitlementCreate(EntitlementCreate), EntitlementDelete(EntitlementDelete), EntitlementUpdate(EntitlementUpdate), GatewayClose(Option<CloseFrame<'static>>), GatewayHeartbeat(u64), GatewayHeartbeatAck, GatewayHello(Hello), GatewayInvalidateSession(bool), GatewayReconnect, GuildAuditLogEntryCreate(Box<GuildAuditLogEntryCreate>), GuildCreate(Box<GuildCreate>), GuildDelete(GuildDelete), GuildEmojisUpdate(GuildEmojisUpdate), GuildIntegrationsUpdate(GuildIntegrationsUpdate), GuildScheduledEventCreate(Box<GuildScheduledEventCreate>), GuildScheduledEventDelete(Box<GuildScheduledEventDelete>), GuildScheduledEventUpdate(Box<GuildScheduledEventUpdate>), GuildScheduledEventUserAdd(GuildScheduledEventUserAdd), GuildScheduledEventUserRemove(GuildScheduledEventUserRemove), GuildStickersUpdate(GuildStickersUpdate), GuildUpdate(Box<GuildUpdate>), IntegrationCreate(Box<IntegrationCreate>), IntegrationDelete(IntegrationDelete), IntegrationUpdate(Box<IntegrationUpdate>), InteractionCreate(Box<InteractionCreate>), InviteCreate(Box<InviteCreate>), InviteDelete(InviteDelete), MemberAdd(Box<MemberAdd>), MemberRemove(MemberRemove), MemberUpdate(Box<MemberUpdate>), MemberChunk(MemberChunk), MessageCreate(Box<MessageCreate>), MessageDelete(MessageDelete), MessageDeleteBulk(MessageDeleteBulk), MessagePollVoteAdd(MessagePollVoteAdd), MessagePollVoteRemove(MessagePollVoteRemove), MessageUpdate(Box<MessageUpdate>), PresenceUpdate(Box<PresenceUpdate>), ReactionAdd(Box<ReactionAdd>), ReactionRemove(Box<ReactionRemove>), ReactionRemoveAll(ReactionRemoveAll), ReactionRemoveEmoji(ReactionRemoveEmoji), Ready(Box<Ready>), Resumed, RoleCreate(RoleCreate), RoleDelete(RoleDelete), RoleUpdate(RoleUpdate), StageInstanceCreate(StageInstanceCreate), StageInstanceDelete(StageInstanceDelete), StageInstanceUpdate(StageInstanceUpdate), ThreadCreate(Box<ThreadCreate>), ThreadDelete(ThreadDelete), ThreadListSync(ThreadListSync), ThreadMemberUpdate(Box<ThreadMemberUpdate>), ThreadMembersUpdate(ThreadMembersUpdate), ThreadUpdate(Box<ThreadUpdate>), TypingStart(Box<TypingStart>), UnavailableGuild(UnavailableGuild), UserUpdate(UserUpdate), VoiceServerUpdate(VoiceServerUpdate), VoiceStateUpdate(Box<VoiceStateUpdate>), WebhooksUpdate(WebhooksUpdate),
}
Expand description

Any type of event that a shard emits.

Flattened type containing all the variants of DispatchEvent and GatewayEvent, along with a gateway close event.

Variants§

§

AutoModerationActionExecution(AutoModerationActionExecution)

Message was blocked by AutoMod according to a rule.

§

AutoModerationRuleCreate(AutoModerationRuleCreate)

Sent when an auto moderation rule is created.

§

AutoModerationRuleDelete(AutoModerationRuleDelete)

Sent when an auto moderation rule is deleted.

§

AutoModerationRuleUpdate(AutoModerationRuleUpdate)

Sent when an auto moderation rule is updated.

§

BanAdd(BanAdd)

A user was banned from a guild.

§

BanRemove(BanRemove)

A user’s ban from a guild was removed.

§

ChannelCreate(Box<ChannelCreate>)

A channel was created.

§

ChannelDelete(Box<ChannelDelete>)

A channel was deleted.

§

ChannelPinsUpdate(ChannelPinsUpdate)

A channel’s pins were updated.

§

ChannelUpdate(Box<ChannelUpdate>)

A channel was updated.

§

CommandPermissionsUpdate(CommandPermissionsUpdate)

A command’s permissions were updated.

§

EntitlementCreate(EntitlementCreate)

A user subscribes to a SKU.

§

EntitlementDelete(EntitlementDelete)

A user’s entitlement is removed.

§

EntitlementUpdate(EntitlementUpdate)

A user’s subscription renews for the next billing period.

The ends_at field will have an updated value with the new expiration date.

§

GatewayClose(Option<CloseFrame<'static>>)

Close message with an optional frame including information about the reason for the close.

§

GatewayHeartbeat(u64)

A heartbeat was sent to or received from the gateway.

§

GatewayHeartbeatAck

A heartbeat acknowledgement was received from the gateway.

§

GatewayHello(Hello)

A “hello” packet was received from the gateway.

§

GatewayInvalidateSession(bool)

A shard’s session was invalidated.

true if resumable. If not, then the shard must do a full reconnect.

§

GatewayReconnect

The gateway is indicating to perform a reconnect.

§

GuildAuditLogEntryCreate(Box<GuildAuditLogEntryCreate>)

A audit log entry was created.

§

GuildCreate(Box<GuildCreate>)

A guild was created.

§

GuildDelete(GuildDelete)

A guild was deleted or the current user was removed from a guild.

§

GuildEmojisUpdate(GuildEmojisUpdate)

A guild’s emojis were updated.

§

GuildIntegrationsUpdate(GuildIntegrationsUpdate)

A guild’s integrations were updated.

§

GuildScheduledEventCreate(Box<GuildScheduledEventCreate>)

A guild scheduled event was created.

§

GuildScheduledEventDelete(Box<GuildScheduledEventDelete>)

A guild scheduled event was deleted.

§

GuildScheduledEventUpdate(Box<GuildScheduledEventUpdate>)

A guild scheduled event was updated.

§

GuildScheduledEventUserAdd(GuildScheduledEventUserAdd)

A user was added to a guild scheduled event.

§

GuildScheduledEventUserRemove(GuildScheduledEventUserRemove)

A user was removed from a guild scheduled event.

§

GuildStickersUpdate(GuildStickersUpdate)

A guild’s stickers were updated.

§

GuildUpdate(Box<GuildUpdate>)

A guild was updated.

§

IntegrationCreate(Box<IntegrationCreate>)

A guild integration was created.

§

IntegrationDelete(IntegrationDelete)

A guild integration was deleted.

§

IntegrationUpdate(Box<IntegrationUpdate>)

A guild integration was updated.

§

InteractionCreate(Box<InteractionCreate>)

An interaction was invoked by a user.

§

InviteCreate(Box<InviteCreate>)

A invite was made.

§

InviteDelete(InviteDelete)

A invite was deleted.

§

MemberAdd(Box<MemberAdd>)

A user was added to a guild.

§

MemberRemove(MemberRemove)

A user was removed from a guild.

§

MemberUpdate(Box<MemberUpdate>)

A user’s member object in a guild was updated.

§

MemberChunk(MemberChunk)

A chunk of members were received from the gateway.

§

MessageCreate(Box<MessageCreate>)

A message was created in a channel.

§

MessageDelete(MessageDelete)

A message was deleted in a channel.

§

MessageDeleteBulk(MessageDeleteBulk)

Multiple messages were deleted in a channel.

§

MessagePollVoteAdd(MessagePollVoteAdd)

A vote was added to a poll.

§

MessagePollVoteRemove(MessagePollVoteRemove)

A vote was removed from a poll.

§

MessageUpdate(Box<MessageUpdate>)

A message was updated in a channel.

§

PresenceUpdate(Box<PresenceUpdate>)

A user’s active presence (such as game or online status) was updated.

§

ReactionAdd(Box<ReactionAdd>)

A reaction was added to a message.

§

ReactionRemove(Box<ReactionRemove>)

A reaction was removed from a message.

§

ReactionRemoveAll(ReactionRemoveAll)

All reactions were removed from a message.

§

ReactionRemoveEmoji(ReactionRemoveEmoji)

All instances of a given emoji from the reactions of a message were removed.

§

Ready(Box<Ready>)

A shard is now “ready” and fully connected.

§

Resumed

A shard has successfully resumed.

§

RoleCreate(RoleCreate)

A role was created in a guild.

§

RoleDelete(RoleDelete)

A role was deleted in a guild.

§

RoleUpdate(RoleUpdate)

A role was updated in a guild.

§

StageInstanceCreate(StageInstanceCreate)

A stage instance was created in a stage channel.

§

StageInstanceDelete(StageInstanceDelete)

A stage instance was deleted in a stage channel.

§

StageInstanceUpdate(StageInstanceUpdate)

A stage instance was updated in a stage channel.

§

ThreadCreate(Box<ThreadCreate>)

A thread has been created, relevant to the current user, or the current user has been added to a thread.

§

ThreadDelete(ThreadDelete)

A thread, relevant to the current user, has been deleted.

§

ThreadListSync(ThreadListSync)

The current user has gained access to a thread.

§

ThreadMemberUpdate(Box<ThreadMemberUpdate>)

The thread member object for the current user has been updated.

§

ThreadMembersUpdate(ThreadMembersUpdate)

A user has been added to or removed from a thread.

§

ThreadUpdate(Box<ThreadUpdate>)

A thread has been updated.

§

TypingStart(Box<TypingStart>)

A user started typing in a channel.

§

UnavailableGuild(UnavailableGuild)

A guild is now unavailable.

§

UserUpdate(UserUpdate)

The current user was updated.

§

VoiceServerUpdate(VoiceServerUpdate)

A voice server update was sent.

§

VoiceStateUpdate(Box<VoiceStateUpdate>)

A voice state in a voice channel was updated.

§

WebhooksUpdate(WebhooksUpdate)

A webhook was updated.

Implementations§

Source§

impl Event

Source

pub const fn guild_id(&self) -> Option<Id<GuildMarker>>

Guild ID of the event, if available.

Source

pub const fn kind(&self) -> EventType

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a copy 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 Debug for Event

Source§

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

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

impl From<DispatchEvent> for Event

Source§

fn from(event: DispatchEvent) -> Self

Converts to this type from the input type.
Source§

impl From<GatewayEvent> for Event

Source§

fn from(event: GatewayEvent) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Event

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Event> for DispatchEvent

Source§

type Error = EventConversionError

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

fn try_from(event: Event) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Event> for GatewayEvent

Source§

type Error = EventConversionError

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

fn try_from(event: Event) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = 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.