mirror of
https://github.com/danbulant/discord.js
synced 2026-07-12 22:50:40 +00:00
fix(UserGuildSettingsUpdate): not creating settings with new guilds (#2150)
This commit is contained in:
parent
862b2ec3d4
commit
1c34819d47
1 changed files with 4 additions and 1 deletions
|
|
@ -1,10 +1,13 @@
|
|||
const AbstractHandler = require('./AbstractHandler');
|
||||
const Constants = require('../../../../util/Constants');
|
||||
const ClientUserGuildSettings = require('../../../../structures/ClientUserGuildSettings');
|
||||
|
||||
class UserGuildSettingsUpdateHandler extends AbstractHandler {
|
||||
handle(packet) {
|
||||
const client = this.packetManager.client;
|
||||
client.user.guildSettings.get(packet.d.guild_id).patch(packet.d);
|
||||
const settings = client.user.guildSettings.get(packet.d.guild_id);
|
||||
if (settings) settings.patch(packet.d);
|
||||
else client.user.guildSettings.set(packet.d.guild_id, new ClientUserGuildSettings(packet.d, client));
|
||||
client.emit(Constants.Events.USER_GUILD_SETTINGS_UPDATE, client.user.guildSettings.get(packet.d.guild_id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue