Skip to content

Commit

Permalink
Change from allSettled to all for promises
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanleminh committed Feb 17, 2024
1 parent 8e2e3b3 commit e0b5583
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/commands/clear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const command: Command = {
)

await properties.guaranteedPlayersNextRoundIds.set(interaction.guild.id, [])
await Promise.allSettled(promises)
await Promise.all(promises)
logger.debug('Cleared data and roles from participants!')
await interaction.editReply(
'I cleared all data and roles from participants!'
Expand Down
5 changes: 3 additions & 2 deletions src/commands/endmatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export const command: Command = {
})
}

await Promise.allSettled(clearTeamRoles(interaction.guild.roles.cache, firstTeamRoleId, secondTeamRoleId))
await Promise.allSettled(promises)
const clearTeamRolesPromise = await Promise.all(clearTeamRoles(interaction.guild.roles.cache, firstTeamRoleId, secondTeamRoleId))
logger.info(JSON.stringify(clearTeamRolesPromise))
await Promise.all(promises)
await interaction.editReply('GG!')
}
}
2 changes: 1 addition & 1 deletion src/commands/endsession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const command: Command = {
properties.guaranteedPlayersNextRoundIds.delete(interaction.guild.id)
)

await Promise.allSettled(promises)
await Promise.all(promises)
logger.debug('Session ended! Cleared all data.')

await interaction.reply('I ended the session and cleared all data.')
Expand Down
4 changes: 2 additions & 2 deletions src/commands/randomize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const command: Command = {
])

const roles = await interaction.guild.roles.fetch()
await Promise.allSettled(
await Promise.all(
clearTeamRoles(roles, firstTeamRoleId, secondTeamRoleId)
)

Expand Down Expand Up @@ -68,7 +68,7 @@ export const command: Command = {
)
}
const randomizedPlayerPool = shuffle(playerPool)
await Promise.allSettled(
await Promise.all(
createTeams(randomizedPlayerPool, firstTeamRoleId, secondTeamRoleId)
)

Expand Down
2 changes: 1 addition & 1 deletion src/commands/startmatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const command: Command = {
const member = interaction.guild!.members.cache.get(player.id)!
promises.push(setVoiceChannel(member, secondTeamVcId, interaction))
})
await Promise.allSettled(promises)
await Promise.all(promises)
await interaction.editReply('GLHF!')
}
}
Expand Down

0 comments on commit e0b5583

Please sign in to comment.