diff --git a/src/client/websocket/handlers/READY.js b/src/client/websocket/handlers/READY.js index 981c973..6b5ce8e 100644 --- a/src/client/websocket/handlers/READY.js +++ b/src/client/websocket/handlers/READY.js @@ -88,12 +88,11 @@ module.exports = (client, { d: data }, shard) => { for (const private_channel of data.private_channels) { client.channels._add(private_channel); } - // Start event - client.on(Events.USER_SETTINGS_UPDATE, s => { - if (('status' in s || 'custom_status' in s) && client.options.readyStatus) { - client.customStatusAuto(client); - } - }); + // Remove event because memory leak + + if (client.options.readyStatus) { + client.customStatusAuto(client); + } /** * Read_state: Return Array: diff --git a/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js b/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js index 265a8be..cc105cb 100644 --- a/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +++ b/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js @@ -2,5 +2,8 @@ const { Events } = require('../../../util/Constants'); module.exports = (client, { d: data }) => { client.setting._patch(data); + if (('status' in data || 'custom_status' in data) && client.options.readyStatus) { + client.customStatusAuto(client); + } return client.emit(Events.USER_SETTINGS_UPDATE, data); };