fix(READY): do not overwrite Client#user when reidentifying

See #3216, this commit attempts to fix losing ClientUser#_typing, which results in no longer being able to clear typing intervals
This commit is contained in:
SpaceEEC
2019-05-16 19:56:19 +02:00
parent 55447fd4da
commit 1bafa4b86b

View File

@@ -3,10 +3,14 @@
let ClientUser;
module.exports = (client, { d: data }, shard) => {
if (!ClientUser) ClientUser = require('../../../structures/ClientUser');
const clientUser = new ClientUser(client, data.user);
client.user = clientUser;
client.users.set(clientUser.id, clientUser);
if (client.user) {
client.user._patch(data.user);
} else {
if (!ClientUser) ClientUser = require('../../../structures/ClientUser');
const clientUser = new ClientUser(client, data.user);
client.user = clientUser;
client.users.set(clientUser.id, clientUser);
}
for (const guild of data.guilds) {
guild.shardID = shard.id;