2022-03-19 17:37:45 +07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
const Action = require('./Action');
|
|
|
|
|
|
|
|
|
|
class MessageUpdateAction extends Action {
|
|
|
|
|
handle(data) {
|
|
|
|
|
const channel = this.getChannel(data);
|
|
|
|
|
if (channel) {
|
2022-03-24 17:55:32 +07:00
|
|
|
if (!channel.isText()) return {};
|
2022-03-19 17:37:45 +07:00
|
|
|
|
|
|
|
|
const { id, channel_id, guild_id, author, timestamp, type } = data;
|
|
|
|
|
const message = this.getMessage({ id, channel_id, guild_id, author, timestamp, type }, channel);
|
|
|
|
|
if (message) {
|
|
|
|
|
const old = message._update(data);
|
|
|
|
|
return {
|
|
|
|
|
old,
|
|
|
|
|
updated: message,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = MessageUpdateAction;
|