discord.io
discord.io copied to clipboard
Bot Voice Channel Disconnect Bug
When disconnected by the server from a voice channel, the following event is triggered:
{ t: 'VOICE_STATE_UPDATE,
s: 139,
op: 0,
d:
{ user_id: 'the_bot_id'
suppress: false,
session_id: 'the_session_id'
self_mute: false,
self_deaf: false,
mute: false,
guild_id: 'the_guild_id'
deaf: false,
channel_id: null } }
Unfortunately the bot still contains the voice channel in bot._vChannels
after this event/disconnect, and subsequent attempts to join the same voice channel will fail until the bot is restarted or manually purged from the channel in some way. It is also plausible (unverified) that the bot is still listed in bot.channels[voice_channel_id].members
As a workaround, it would appear that leaving the channel with bot.leaveVoiceChannel(voice_channel_id)
after the above event fires will clear the ghost entry and allow reconnects to that channel.
Note: The server appears to be triggering this event between ~5 and ~6 hours of the bot being idle in voice
This has been left opened for a reason, and no, pinging me on Discord isn't a good way to keep track on the issue.