mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
ESLint stuff...
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user