Skip to main content

djs_model/gateway/
opcode.rs

1use crate::macros::int_enum;
2
3int_enum! {
4    /// A [gateway opcode](https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-opcodes):
5    /// the `op` field of every gateway payload.
6    ///
7    /// discord.js counterpart: `GatewayOpcodes` (re-exported from discord-api-types).
8    pub enum OpCode: u8 {
9        /// *Receive.* An event was dispatched.
10        Dispatch = 0,
11        /// *Send/Receive.* Keeps the connection alive. When received, a heartbeat must be sent
12        /// immediately.
13        Heartbeat = 1,
14        /// *Send.* Starts a new session during the initial handshake.
15        Identify = 2,
16        /// *Send.* Updates the client's presence.
17        PresenceUpdate = 3,
18        /// *Send.* Joins, leaves or moves between voice channels.
19        VoiceStateUpdate = 4,
20        /// *Send.* Resumes a previous session that was disconnected.
21        Resume = 6,
22        /// *Receive.* The client should reconnect and resume immediately.
23        Reconnect = 7,
24        /// *Send.* Requests information about offline guild members in a large guild.
25        RequestGuildMembers = 8,
26        /// *Receive.* The session has been invalidated. The client should reconnect and
27        /// identify/resume accordingly.
28        InvalidSession = 9,
29        /// *Receive.* Sent immediately after connecting; contains the heartbeat interval.
30        Hello = 10,
31        /// *Receive.* Sent in response to receiving a heartbeat to acknowledge that it has been
32        /// received.
33        HeartbeatAck = 11,
34        /// *Send.* Requests soundboard sounds of a list of guilds.
35        RequestSoundboardSounds = 31,
36        /// *Send.* Requests ephemeral channel information (such as voice channel statuses) for
37        /// a guild.
38        RequestChannelInfo = 43,
39    }
40}