Skip to content

Commit

Permalink
Emit partial guildEmojisUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Apr 1, 2021
1 parent 6771b3f commit 16c6a76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ declare namespace Eris {
(event: "guildBanAdd" | "guildBanRemove", listener: (guild: Guild, user: User) => void): T;
(event: "guildAvailable" | "guildCreate", listener: (guild: Guild) => void): T;
(event: "guildDelete", listener: (guild: PossiblyUncachedGuild) => void): T;
(event: "guildEmojisUpdate", listener: (guild: Guild, emojis: Emoji[], oldEmojis: Emoji[]) => void): T;
(event: "guildEmojisUpdate", listener: (guild: PossiblyUncachedGuild, emojis: Emoji[], oldEmojis: Emoji[] | null) => void): T;
(event: "guildMemberAdd", listener: (guild: Guild, member: Member) => void): T;
(event: "guildMemberChunk", listener: (guild: Guild, members: Member[]) => void): T;
(event: "guildMemberRemove", listener: (guild: Guild, member: Member | MemberPartial) => void): T;
Expand Down
11 changes: 8 additions & 3 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1984,16 +1984,21 @@ class Shard extends EventEmitter {
}
case "GUILD_EMOJIS_UPDATE": {
const guild = this.client.guilds.get(packet.d.guild_id);
const {emojis: oldEmojis} = guild;
guild.update(packet.d);
let oldEmojis = null;
let emojis = packet.d.emojis;
if(guild) {
oldEmojis = guild.emojis;
guild.update(packet.d);
emojis = guild.emojis;
}
/**
* Fired when a guild's emojis are updated
* @event Client#guildEmojisUpdate
* @prop {Guild} guild The guild
* @prop {Array} emojis The updated emojis of the guild
* @prop {Array} oldEmojis The old emojis of the guild
*/
this.emit("guildEmojisUpdate", guild, guild.emojis, oldEmojis);
this.emit("guildEmojisUpdate", guild || {id: packet.d.guild_id}, emojis, oldEmojis);
break;
}
case "CHANNEL_PINS_UPDATE": {
Expand Down

0 comments on commit 16c6a76

Please sign in to comment.