mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
fix(UserGuildSettingsUpdate): not creating settings with new guilds (#2150)
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
const AbstractHandler = require('./AbstractHandler');
|
const AbstractHandler = require('./AbstractHandler');
|
||||||
const Constants = require('../../../../util/Constants');
|
const Constants = require('../../../../util/Constants');
|
||||||
|
const ClientUserGuildSettings = require('../../../../structures/ClientUserGuildSettings');
|
||||||
|
|
||||||
class UserGuildSettingsUpdateHandler extends AbstractHandler {
|
class UserGuildSettingsUpdateHandler extends AbstractHandler {
|
||||||
handle(packet) {
|
handle(packet) {
|
||||||
const client = this.packetManager.client;
|
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));
|
client.emit(Constants.Events.USER_GUILD_SETTINGS_UPDATE, client.user.guildSettings.get(packet.d.guild_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user