Skip to content

Commit

Permalink
Update Error and OpCodes to match docs (#347)
Browse files Browse the repository at this point in the history
* Update Error and OpCodes to match docs

* Retrigger CI

* Update rest/src/main/kotlin/json/JsonErrorCode.kt

Co-authored-by: Bart Arys <[email protected]>

* Update rest/src/main/kotlin/json/JsonErrorCode.kt

Co-authored-by: Bart Arys <[email protected]>

* Update rest/src/main/kotlin/json/JsonErrorCode.kt

Co-authored-by: Bart Arys <[email protected]>

* Update rest/src/main/kotlin/json/JsonErrorCode.kt

Co-authored-by: Bart Arys <[email protected]>

Co-authored-by: Bart Arys <[email protected]>
Co-authored-by: Hope <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2021
1 parent 990a4ed commit fb5085c
Show file tree
Hide file tree
Showing 2 changed files with 368 additions and 2 deletions.
46 changes: 45 additions & 1 deletion gateway/src/main/kotlin/OpCode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,60 @@ import kotlinx.serialization.encoding.Encoder
enum class OpCode(val code: Int) {
/** The default code for unknown values. */
Unknown(Int.MIN_VALUE),

/**
* An event was dispatched.
*/
Dispatch(0),

/**
* Fired periodically by the client to keep the connection alive.
*/
Heartbeat(1),

/**
* Starts a new session during the initial handshake.
*/
Identify(2),

/**
* Update the client's presence.
*/
StatusUpdate(3),

/**
* Used to join/leave or move between voice channels.
*/
VoiceStateUpdate(4),

/**
* You should attempt to reconnect and resume immediately.
*/
Resume(6),

/**
* You should attempt to reconnect and resume immediately.
*/
Reconnect(7),

/**
* Request information about offline guild members in a large guild.
*/
RequestGuildMembers(8),

/**
* The session has been invalidated. You should reconnect and identify/resume accordingly.
*/
InvalidSession(9),

/**
* Sent immediately after connecting, contains the `heartbeat_interval` to use.
*/
Hello(10),

/**
* Sent in response to receiving a heartbeat to acknowledge that it has been received.
*/
HeartbeatACK(11);

companion object OpCodeSerializer : KSerializer<OpCode> {
Expand All @@ -37,4 +81,4 @@ enum class OpCode(val code: Int) {
}
}

}
}
Loading

0 comments on commit fb5085c

Please sign in to comment.