diff options
| author | Mel <einebeere@gmail.com> | 2022-04-12 17:21:05 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-04-12 17:21:05 +0200 |
| commit | 6163d259ed52991e2f95632b5a0516607aa56a5f (patch) | |
| tree | d87514d024d55f976ec78176fd0b0d8ebe946d7c /pkg/discord/gateway/closecodes.go | |
| parent | 6cd2890450aaf71e97004d421237996f0a42d04c (diff) | |
| download | jinx-6163d259ed52991e2f95632b5a0516607aa56a5f.tar.zst jinx-6163d259ed52991e2f95632b5a0516607aa56a5f.zip | |
Handle gateway errors and reconnections
Diffstat (limited to 'pkg/discord/gateway/closecodes.go')
| -rw-r--r-- | pkg/discord/gateway/closecodes.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/discord/gateway/closecodes.go b/pkg/discord/gateway/closecodes.go new file mode 100644 index 0000000..d6e9804 --- /dev/null +++ b/pkg/discord/gateway/closecodes.go @@ -0,0 +1,22 @@ +package gateway + +// REF: https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes +const ( + // Reconnect when receiving these. + CloseUnknownError = 4000 // We're not sure what went wrong. Try reconnecting? + CloseUnkownOpcode = 4001 // You sent an invalid Gateway opcode or an invalid payload for an opcode. Don't do that! + CloseDecodeError = 4002 // You sent an invalid payload to us. Don't do that! + CloseNotAuthenticated = 4003 // You sent us a payload prior to identifying. + CloseAlreadyAuthenticated = 4005 // You sent more than one identify payload. Don't do that! + CloseInvalidSeq = 4007 // The sequence sent when resuming the session was invalid. Reconnect and start a new session. + CloseRateLimited = 4008 // Woah nelly! You're sending payloads to us too quickly. Slow it down! You will be disconnected on receiving this. + CloseSessionTimedOut = 4009 // Your session timed out. Reconnect and start a new one. + + // Don't attempt to reconnect on any of the following. + CloseAuthenticationFailed = 4004 // The account token sent with your identify payload is incorrect. + CloseInvalidShard = 4010 // You sent us an invalid shard when identifying. + CloseShardingRequired = 4011 // The session would have handled too many guilds - you are required to shard your connection in order to connect. + CloseInvalidAPIVersion = 4012 // You sent an invalid version for the gateway. + CloseInvalidIntents = 4013 // You sent an invalid intent for a Gateway Intent. You may have incorrectly calculated the bitwise value. + CloseDisallowedIntents = 4014 // You sent a disallowed intent for a Gateway Intent. You may have tried to specify an intent that you have not enabled or are not approved for. +) |
