Skip to content

Commit

Permalink
Revert "Replace cache calls with actual fetches"
Browse files Browse the repository at this point in the history
This reverts commit afa137a.
  • Loading branch information
stefanleminh committed Jun 17, 2023
1 parent afa137a commit 0f622d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/commands/listteams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export const command: Command = {
if (interaction.guild == null) return
if (!interaction.deferred) await interaction.deferReply()

// Update cache with new roles
await interaction.guild.members.fetch({ force: true })
await interaction.guild.roles.fetch()

const [firstTeamRoleId, secondTeamRoleId, spectatorRoleId] = await Promise.all([
properties.firstTeamRoleIds.get(interaction.guild.id),
properties.secondTeamRoleIds.get(interaction.guild.id),
Expand All @@ -34,8 +30,10 @@ export const command: Command = {
properties.firstTeamVcs.get(interaction.guild.id),
properties.secondTeamVcs.get(interaction.guild.id)
])

const lobbyVcMembers: Collection<string, GuildMember> = (await interaction.guild.channels.fetch()).get(lobbyVcId)!.members.filter(member => !member.user.bot)
const lobbyVcMembers: Collection<string, GuildMember> = (interaction.guild.channels.cache
.get(lobbyVcId)!
.members as Collection<string, GuildMember>)
.filter(member => !member.user.bot)
const embeds = createTeamEmbeds(lobbyVcMembers, firstTeamRoleId, secondTeamRoleId, spectatorRoleId, interaction.guild, firstTeamVcId, secondTeamVcId, lobbyVcId)
await interaction.editReply({ embeds })
}
Expand Down
3 changes: 3 additions & 0 deletions src/commands/randomize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export const command: Command = {
createTeams(randomizedPlayerPool, firstTeamRoleId, secondTeamRoleId)
)

// Update cache with new roles
await interaction.guild.members.fetch()

logger.info('==========randomize end==========')

await listTeams.command.execute(interaction, properties)
Expand Down

0 comments on commit 0f622d0

Please sign in to comment.