mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Remove all data stores! Move to maps
This commit is contained in:
@@ -38,6 +38,12 @@ class WebSocketManager {
|
||||
* @type {?Number}
|
||||
*/
|
||||
this.sequence = -1;
|
||||
|
||||
/**
|
||||
* The gateway address for this WebSocket connection, null if not yet available.
|
||||
* @type {?String}
|
||||
*/
|
||||
this.gateway = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +97,7 @@ class WebSocketManager {
|
||||
*/
|
||||
_sendResume() {
|
||||
const payload = {
|
||||
token: this.client.store.token,
|
||||
token: this.client.token,
|
||||
session_id: this.sessionID,
|
||||
seq: this.sequence,
|
||||
};
|
||||
@@ -109,7 +115,7 @@ class WebSocketManager {
|
||||
_sendNewIdentify() {
|
||||
this.reconnecting = false;
|
||||
const payload = this.client.options.ws;
|
||||
payload.token = this.client.store.token;
|
||||
payload.token = this.client.token;
|
||||
|
||||
this.send({
|
||||
op: Constants.OPCodes.IDENTIFY,
|
||||
@@ -191,7 +197,7 @@ class WebSocketManager {
|
||||
this.ws.close();
|
||||
this.packetManager.handleQueue();
|
||||
this.client.emit(Constants.Events.RECONNECTING);
|
||||
this.connect(this.client.store.gateway);
|
||||
this.connect(this.client.ws.gateway);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class GuildCreateHandler extends AbstractHandler {
|
||||
}
|
||||
} else {
|
||||
// a new guild
|
||||
client.store.newGuild(data);
|
||||
client.dataManager.newGuild(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class PresenceUpdateHandler extends AbstractHandler {
|
||||
const guild = client.guilds.get(data.guild_id);
|
||||
|
||||
function makeUser(newUser) {
|
||||
return client.store.newUser(newUser);
|
||||
return client.dataManager.newUser(newUser);
|
||||
}
|
||||
|
||||
// step 1
|
||||
|
||||
@@ -10,14 +10,14 @@ class ReadyHandler extends AbstractHandler {
|
||||
const client = this.packetManager.client;
|
||||
|
||||
const clientUser = new ClientUser(client, data.user);
|
||||
client.store.user = clientUser;
|
||||
client.user = clientUser;
|
||||
client.users.set(clientUser.id, clientUser);
|
||||
for (const guild of data.guilds) {
|
||||
client.store.newGuild(guild);
|
||||
client.dataManager.newGuild(guild);
|
||||
}
|
||||
|
||||
for (const privateDM of data.private_channels) {
|
||||
client.store.newChannel(privateDM);
|
||||
client.dataManager.newChannel(privateDM);
|
||||
}
|
||||
|
||||
this.packetManager.ws.sessionID = data.session_id;
|
||||
|
||||
Reference in New Issue
Block a user