mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
add auth session change handling (#1339)
* add auth session change handling * eek
This commit is contained in:
@@ -71,6 +71,16 @@ class WebSocketPacketManager {
|
||||
}
|
||||
|
||||
handle(packet) {
|
||||
if (packet.t === Constants.WSEvents.AUTH_SESSION_CHANGE) {
|
||||
if (packet.d.new_token) {
|
||||
this.client.token = packet.d.new_token;
|
||||
this.ws._sendResume();
|
||||
} else {
|
||||
this.client.destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet.op === Constants.OPCodes.RECONNECT) {
|
||||
this.setSequence(packet.s);
|
||||
this.ws.tryReconnect();
|
||||
|
||||
@@ -356,6 +356,7 @@ exports.Events = {
|
||||
* - VOICE_SERVER_UPDATE
|
||||
* - RELATIONSHIP_ADD
|
||||
* - RELATIONSHIP_REMOVE
|
||||
* - AUTH_SESSION_CHANGE
|
||||
* @typedef {string} WSEventType
|
||||
*/
|
||||
exports.WSEvents = {
|
||||
@@ -393,6 +394,7 @@ exports.WSEvents = {
|
||||
VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE',
|
||||
RELATIONSHIP_ADD: 'RELATIONSHIP_ADD',
|
||||
RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',
|
||||
AUTH_SESSION_CHANGE: 'AUTH_SESSION_CHANGE',
|
||||
};
|
||||
|
||||
exports.MessageTypes = [
|
||||
@@ -441,3 +443,4 @@ exports.Colors = {
|
||||
DARK_BUT_NOT_BLACK: 0x2C2F33,
|
||||
NOT_QUITE_BLACK: 0x23272A,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user