mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
Add functionality for GuildEmoji events
This commit is contained in:
@@ -1,22 +1,8 @@
|
||||
const Action = require('./Action');
|
||||
|
||||
class GuildEmojiUpdateAction extends Action {
|
||||
handle(data, guild) {
|
||||
const client = this.client;
|
||||
for (let emoji of data.emojis) {
|
||||
const already = guild.emojis.has(emoji.id);
|
||||
if (already) {
|
||||
client.dataManager.updateEmoji(guild.emojis.get(emoji.id), emoji);
|
||||
} else {
|
||||
emoji = client.dataManager.newEmoji(emoji, guild);
|
||||
}
|
||||
}
|
||||
for (let emoji of guild.emojis) {
|
||||
if (!data.emoijs.has(emoji.id)) client.dataManager.killEmoji(emoji);
|
||||
}
|
||||
return {
|
||||
emojis: data.emojis,
|
||||
};
|
||||
handle(oldEmoji, newEmoji) {
|
||||
this.client.dataManager.updateEmoji(oldEmoji, newEmoji);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user