mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
I think I got ChannelUpdate working??
This commit is contained in:
39
src/client/actions/ChannelUpdate.js
Normal file
39
src/client/actions/ChannelUpdate.js
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
const Action = require('./Action');
|
||||
const Constants = require('../../util/Constants');
|
||||
const CloneObject = require('../../util/CloneObject');
|
||||
const Message = require('../../structures/Message');
|
||||
|
||||
class ChannelUpdateAction extends Action {
|
||||
|
||||
constructor(client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
handle(data) {
|
||||
|
||||
let client = this.client;
|
||||
let channel = client.store.get('channels', data.id);
|
||||
|
||||
if (channel) {
|
||||
let 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;
|
||||
Reference in New Issue
Block a user