Skip to content

Commit

Permalink
Update nation.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Aug 13, 2024
1 parent 2c23be1 commit 1eed905
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aurora/slashcommands/nation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,10 @@ export default {
if (nation.discord)
nationEmbed.setURL(nation.discord)

const onlinePlayers = await Aurora.Players.online().catch(() => {})
if (onlinePlayers) {
const ops = await Aurora.Players.online().catch(() => {})
if (ops) {
// Filter nation residents by which are online
const onlineNationResidents = removeDuplicates(
nation.residents.filter(resident => onlinePlayers.find(op => resident == op.name)))
const onlineNationResidents = removeDuplicates(nation.residents.filter(res => ops.find(op => res == op.name)))

if (onlineNationResidents.length >= 1) nationEmbed.addFields(embedField(
"Online Residents [" + onlineNationResidents.length + "]",
Expand Down

0 comments on commit 1eed905

Please sign in to comment.