#[non_exhaustive]pub enum OpCode {
Show 14 variants
Dispatch,
Heartbeat,
Identify,
PresenceUpdate,
VoiceStateUpdate,
Resume,
Reconnect,
RequestGuildMembers,
InvalidSession,
Hello,
HeartbeatAck,
RequestSoundboardSounds,
RequestChannelInfo,
Unknown(u8),
}Expand description
A gateway opcode:
the op field of every gateway payload.
discord.js counterpart: GatewayOpcodes (re-exported from discord-api-types).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dispatch
Receive. An event was dispatched.
Heartbeat
Send/Receive. Keeps the connection alive. When received, a heartbeat must be sent immediately.
Identify
Send. Starts a new session during the initial handshake.
PresenceUpdate
Send. Updates the client’s presence.
VoiceStateUpdate
Send. Joins, leaves or moves between voice channels.
Resume
Send. Resumes a previous session that was disconnected.
Reconnect
Receive. The client should reconnect and resume immediately.
RequestGuildMembers
Send. Requests information about offline guild members in a large guild.
InvalidSession
Receive. The session has been invalidated. The client should reconnect and identify/resume accordingly.
Hello
Receive. Sent immediately after connecting; contains the heartbeat interval.
HeartbeatAck
Receive. Sent in response to receiving a heartbeat to acknowledge that it has been received.
RequestSoundboardSounds
Send. Requests soundboard sounds of a list of guilds.
RequestChannelInfo
Send. Requests ephemeral channel information (such as voice channel statuses) for a guild.
Unknown(u8)
A value that this version of the library does not know about.
Discord may add new values at any time. They are preserved here so that no
information is lost and deserialization never fails because of them. Prefer
OpCode::from over constructing this variant directly.
Implementations§
Source§impl OpCode
impl OpCode
Sourcepub const fn value(self) -> u8
pub const fn value(self) -> u8
Returns the raw integer value Discord uses for this variant.
discord.js counterpart: the enum’s numeric value in discord-api-types.
Sourcepub const fn is_unknown(self) -> bool
pub const fn is_unknown(self) -> bool
Returns true if this is a value the library does not know about.
discord.js counterpart: none (discord.js passes unknown numbers through).
Sourcepub const fn from_value(value: u8) -> Self
pub const fn from_value(value: u8) -> Self
Converts a raw value into the matching variant, or Self::Unknown.
discord.js counterpart: none (discord.js passes unknown numbers through).