ESLint stuff...

This commit is contained in:
Amish Shah
2016-08-13 14:44:49 +01:00
parent 53d767ec04
commit b8db4c4f4b
74 changed files with 2574 additions and 2956 deletions

View File

@@ -1,54 +1,49 @@
'use strict';
const Action = require('./Action');
const Constants = require('../../util/Constants');
const Message = require('../../structures/Message');
class GuildDeleteAction extends Action {
constructor(client) {
super(client);
this.deleted = {};
this.timeouts = [];
}
constructor(client) {
super(client);
this.deleted = {};
this.timeouts = [];
}
handle(data) {
handle(data) {
const client = this.client;
let guild = client.store.get('guilds', data.id);
let client = this.client;
let guild = client.store.get('guilds', data.id);
if (guild) {
if (guild.available && data.unavailable) {
// guild is unavailable
guild.available = false;
client.emit(Constants.Events.GUILD_UNAVAILABLE, guild);
if (guild) {
if (guild.available && data.unavailable) {
// guild is unavailable
guild.available = false;
client.emit(Constants.Events.GUILD_UNAVAILABLE, guild);
// stops the GuildDelete packet thinking a guild was actually deleted,
// handles emitting of event itself
return {
guild: null,
};
}
// delete guild
client.store.remove('guilds', guild);
this.deleted[guild.id] = guild;
this.scheduleForDeletion(guild.id);
} else if (this.deleted[data.id]) {
guild = this.deleted[data.id];
}
// stops the GuildDelete packet thinking a guild was actually deleted,
// handles emitting of event itself
return {
guild: null,
};
} else {
// delete guild
client.store.remove('guilds', guild);
this.deleted[guild.id] = guild;
this.scheduleForDeletion(guild.id);
}
} else if (this.deleted[data.id]) {
guild = this.deleted[data.id];
}
return {
guild,
};
}
return {
guild,
};
}
scheduleForDeletion(id) {
this.timeouts.push(
setTimeout(() => delete this.deleted[id],
this.client.options.rest_ws_bridge_timeout)
);
}
};
scheduleForDeletion(id) {
this.timeouts.push(
setTimeout(() => delete this.deleted[id],
this.client.options.rest_ws_bridge_timeout)
);
}
}
module.exports = GuildDeleteAction;