diff --git a/aurora/commands/alliance.ts b/aurora/commands/alliance.ts index 823b04bb..f774215b 100644 --- a/aurora/commands/alliance.ts +++ b/aurora/commands/alliance.ts @@ -110,6 +110,15 @@ export default { if (arg1Lower && !devArgs.includes(arg1Lower)) { if (arg1Lower != "online") return + // TODO: Do this in getAlliance() so we dont req ops twice. + const ops = await Aurora.Players.online(true).catch(() => null) as SquaremapPlayer[] + if (!ops) return m.edit({embeds: [new EmbedBuilder() + .setTitle(`Error fetching online players`) + .setDescription("") + .setColor(Colors.Red) + .setTimestamp() + ]}).then(m => setTimeout(() => m.delete(), 10000)).catch(() => {}) + const foundAlliance = await database.Aurora.getAlliance(args[1]) if (!foundAlliance) return m.edit({embeds: [new EmbedBuilder() .setTitle("Error fetching alliance") @@ -122,15 +131,6 @@ export default { }) ]}).then(m => setTimeout(() => m.delete(), 10000)).catch(() => {}) - // TODO: Do this in getAlliance() so we dont req ops twice. - const ops = await Aurora.Players.online(true).catch(() => null) as SquaremapPlayer[] - if (!ops) return m.edit({embeds: [new EmbedBuilder() - .setTitle(`Error fetching online players`) - .setDescription("") - .setColor(Colors.Red) - .setTimestamp() - ]}).then(m => setTimeout(() => m.delete(), 10000)).catch(() => {}) - const name = getName(foundAlliance) const allianceOps = ops.filter(op => foundAlliance.online.find(p => p == op.name)) ?? []