Enum twilight_model::gateway::OpCode
source · #[non_exhaustive]#[repr(u8)]pub enum OpCode {
Dispatch,
Heartbeat,
Identify,
PresenceUpdate,
VoiceStateUpdate,
Resume,
Reconnect,
RequestGuildMembers,
InvalidSession,
Hello,
HeartbeatAck,
}
Expand description
Gateway event’s payload type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dispatch
DispatchEvent
and sequence number.
Will only be received when connected to the gateway with an active session.
Heartbeat
Periodically sent to maintain the gateway connection and may be received to immediately request one.
Identify
Start a new session.
PresenceUpdate
Request to update the client’s presence.
VoiceStateUpdate
Request to join, leave or move between voice channels.
Resume
Resume a previously disconnected session, skipping over Identify
.
Reconnect
Indicates that a reconnect is required.
RequestGuildMembers
Request a list of members for a guild.
InvalidSession
Received when the session is invalidated.
Hello
Received after connecting, contains the heartbeat interval.
HeartbeatAck
Received in response to sending a Heartbeat
.
Implementations§
source§impl OpCode
impl OpCode
sourcepub const fn from(code: u8) -> Option<Self>
pub const fn from(code: u8) -> Option<Self>
Try to match an integer value to an opcode, returning None
if no
match is found.
sourcepub const fn is_received(self) -> bool
pub const fn is_received(self) -> bool
Whether the opcode is received by the client.
This includes the following opcodes: