opcode.rs
1 use serde_repr::{Deserialize_repr, Serialize_repr}; 2 3 /// Gateway event's payload type. 4 #[derive( 5 Clone, Copy, Debug, Deserialize_repr, Eq, Hash, PartialEq, Serialize_repr, 6 )] 7 #[repr(u8)] 8 pub enum OpCode { 9 /// [`DispatchEvent`] and sequence number. 10 /// 11 /// Will only be received when connected to the gateway with an active 12 /// session. 13 /// 14 /// [`DispatchEvent`]: super::event::DispatchEvent 15 Dispatch = 0, 16 /// Periodically sent to maintain the gateway connection and may be received 17 /// to immediately request one. 18 Heartbeat = 1, 19 /// Start a new session. 20 Identify = 2, 21 /// Request to update the client's presence. 22 PresenceUpdate = 3, 23 /// Request to join, leave or move between voice channels. 24 VoiceStateUpdate = 4, 25 /// Resume a previously disconnected session, skipping over [`Identify`]. 26 /// 27 /// [`Identify`]: Self::Identify 28 Resume = 6, 29 /// Indicates that a reconnect is required. 30 Reconnect = 7, 31 /// Request a list of members for a guild. 32 RequestGuildMembers = 8, 33 /// Received when the session is invalidated. 34 InvalidSession = 9, 35 /// Received after connecting, contains the heartbeat interval. 36 Hello = 10, 37 /// Received in response to sending a [`Heartbeat`]. 38 /// 39 /// [`Heartbeat`]: Self::Heartbeat 40 HeartbeatAck = 11, 41 }