Skip to content

Commit

Permalink
Update alliance.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jul 22, 2024
1 parent b21339c commit c8a88b3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions aurora/commands/alliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)) ?? []
Expand Down

0 comments on commit c8a88b3

Please sign in to comment.