Added Guild Deletion

This commit is contained in:
hydrabolt
2016-05-01 14:51:46 +01:00
parent 3a0426482e
commit f95c588d87
12 changed files with 129 additions and 26 deletions

View File

@@ -8,6 +8,8 @@ class ChannelDeleteAction extends Action {
constructor(client) {
super(client);
this.timeouts = [];
this.deleted = {};
}
handle(data) {
@@ -15,13 +17,28 @@ class ChannelDeleteAction extends Action {
let channel = client.store.get('channels', data.id);
if (channel) {
client.store.KillChannel(channel);
this.deleted[channel.id] = channel;
this.scheduleForDeletion(channel.id);
} else if (this.deleted[data.id]) {
channel = this.deleted[data.id];
}
return {
channel,
};
}
scheduleForDeletion(id) {
this.timeouts.push(
setTimeout(() => delete this.deleted[id],
this.client.options.rest_ws_bridge_timeout)
);
}
};
module.exports = ChannelDeleteAction;