Skip to content

Commit

Permalink
fix: State of voice channels not being restored upon bot start-up. (#149
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vxern authored Jan 1, 2023
1 parent 72db53d commit c20756d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/dynamic-voice-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const service: ServiceStarter = ([client, bot]) => {
const voiceChannelStatesTuples = getVoiceChannelStatesTuples(guild);
if (voiceChannelStatesTuples.length === 0) return;

for (const [_channel, voiceStates] of voiceChannelStatesTuples) {
for (const voiceState of voiceStates) {
onVoiceStateUpdate([client, bot], voiceState);
}
}

const freeChannels = voiceChannelStatesTuples.filter(([_channel, states]) => states.length === 0)
.map(([channel]) => channel);
// If there is up to one free channel already, do not process.
Expand Down

0 comments on commit c20756d

Please sign in to comment.