summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/client/actions/GuildEmojiCreate.js
blob: 61858cf573c889c3a4b7e771b77b7a9c81b657d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict';

const Action = require('./Action');
const Events = require('../../util/Events');

class GuildEmojiCreateAction extends Action {
  handle(guild, createdEmoji) {
    const already = guild.emojis.cache.has(createdEmoji.id);
    const emoji = guild.emojis._add(createdEmoji);
    /**
     * Emitted whenever a custom emoji is created in a guild.
     * @event Client#emojiCreate
     * @param {GuildEmoji} emoji The emoji that was created
     */
    if (!already) this.client.emit(Events.GuildEmojiCreate, emoji);
    return { emoji };
  }
}

module.exports = GuildEmojiCreateAction;