summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/client/actions/ChannelDelete.js
blob: acf03d90527c64948a4db87691a26f9f55181d67 (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 ChannelDeleteAction extends Action {
  handle(data) {
    const client = this.client;
    const channel = client.channels.cache.get(data.id);

    if (channel) {
      client.channels._remove(channel.id);
      /**
       * Emitted whenever a channel is deleted.
       * @event Client#channelDelete
       * @param {DMChannel|GuildChannel} channel The channel that was deleted
       */
      client.emit(Events.ChannelDelete, channel);
    }
  }
}

module.exports = ChannelDeleteAction;