Skip to content

Commit

Permalink
fix(UserGuildSettingsUpdate): not creating settings with new guilds (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewdcario authored and iCrawl committed Dec 6, 2017
1 parent 862b2ec commit 1c34819
Showing 1 changed file with 4 additions and 1 deletion.
@@ -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));
}
}
Expand Down

0 comments on commit 1c34819

Please sign in to comment.