fix(event): userSettingsUpdate memory leak

This commit is contained in:
March 7th 2022-06-10 15:51:31 +07:00
parent 977b2fb8a3
commit 21bbfe4aa2
2 changed files with 8 additions and 6 deletions

View File

@ -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:

View File

@ -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);
};