Files
discord.js/src/client/actions/ChannelDelete.js
Braxton f0c4d0e834 feat: Add "deleted" property to multiple structures. (#2556)
* Add "deleted" property to "Message" structure

* Add "deleted" property to Multiple structures

Structures edited:
- Channel
- Emoji
- Guild
- Guild Member
- Role

* Update "deletable" getter

* Fix ESLint "no-trailing-spaces" errors

* Requested Change: Mark w/ bulkDelete
2018-05-28 17:42:51 -05:00

31 lines
685 B
JavaScript

const Action = require('./Action');
const { Events } = require('../../util/Constants');
class ChannelDeleteAction extends Action {
constructor(client) {
super(client);
this.deleted = new Map();
}
handle(data) {
const client = this.client;
let channel = client.channels.get(data.id);
if (channel) {
client.channels.remove(channel.id);
channel.deleted = true;
client.emit(Events.CHANNEL_DELETE, channel);
}
return { channel };
}
}
/**
* Emitted whenever a channel is deleted.
* @event Client#channelDelete
* @param {GroupDMChannel|GuildChannel} channel The channel that was deleted
*/
module.exports = ChannelDeleteAction;