mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
* chore: consistency/prettier * chore: rebase * chore: rebase * chore: include typings * fix: include typings file in prettier lint-staged
30 lines
733 B
JavaScript
30 lines
733 B
JavaScript
'use strict';
|
|
|
|
const Action = require('./Action');
|
|
const { Events } = require('../../util/Constants');
|
|
|
|
class MessageDeleteAction extends Action {
|
|
handle(data) {
|
|
const client = this.client;
|
|
const channel = this.getChannel(data);
|
|
let message;
|
|
if (channel) {
|
|
message = this.getMessage(data, channel);
|
|
if (message) {
|
|
channel.messages.cache.delete(message.id);
|
|
message.deleted = true;
|
|
/**
|
|
* Emitted whenever a message is deleted.
|
|
* @event Client#messageDelete
|
|
* @param {Message} message The deleted message
|
|
*/
|
|
client.emit(Events.MESSAGE_DELETE, message);
|
|
}
|
|
}
|
|
|
|
return { message };
|
|
}
|
|
}
|
|
|
|
module.exports = MessageDeleteAction;
|