mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
32 lines
696 B
JavaScript
32 lines
696 B
JavaScript
const Action = require('./Action');
|
|
const Constants = require('../../util/Constants');
|
|
const cloneObject = require('../../util/CloneObject');
|
|
|
|
class ChannelUpdateAction extends Action {
|
|
|
|
handle(data) {
|
|
const client = this.client;
|
|
const channel = client.store.get('channels', data.id);
|
|
|
|
if (channel) {
|
|
const oldChannel = cloneObject(channel);
|
|
channel.setup(data);
|
|
if (!oldChannel.equals(data)) {
|
|
client.emit(Constants.Events.CHANNEL_UPDATE, oldChannel, channel);
|
|
}
|
|
|
|
return {
|
|
old: oldChannel,
|
|
updated: channel,
|
|
};
|
|
}
|
|
|
|
return {
|
|
old: null,
|
|
updated: null,
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = ChannelUpdateAction;
|