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

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

class ChannelCreateAction extends Action {
  handle(data) {
    const client = this.client;
    const existing = client.channels.cache.has(data.id);
    const channel = client.channels._add(data);
    if (!existing && channel) {
      /**
       * Emitted whenever a guild channel is created.
       * @event Client#channelCreate
       * @param {GuildChannel} channel The channel that was created
       */
      client.emit(Events.ChannelCreate, channel);
    }
    return { channel };
  }
}

module.exports = ChannelCreateAction;