cannawen / dota-gsi-discord-bot

Use Dota 2's Game State Integration API to make helpful announcements in a discord voice channel
MIT License
5 stars 2 forks source link

[feature] if everyone leaves a discord channel, bot should leave too #126

Closed cannawen closed 12 months ago

cannawen commented 1 year ago
            this.client.on("voiceStateUpdate", (oldState, _) => {
                if (oldState.channel?.members.size === 1) {
                    getVoiceConnection(oldState.guild.id)?.disconnect();
                }
            });

This works to disconnect the bot in discordClient but it messes up the state in our engine because we save the subscription. Leads to the coaching session still being "active" and the auto-connect no longer working.