MusicBot: Bot will not rejoin voice channel if idle for too long

I have AutoSummon disabled and have the bot set to auto-join my server’s music voice channel. If the bot goes without playing music for too long, it will leave the voice channel. It responds to commands as expected and can be restarted, but it will not rejoin the voice channel even if users join, there are songs in the queue, or someone adds a song to the queue. I get this error.

future: <Task finished coro=<MusicPlayer.websocket_check() done, defined at /home/discord/MusicBot/musicbot/player.py:280> exception=TimeoutError()>
Traceback (most recent call last):
  File "/home/discord/MusicBot/musicbot/player.py", line 287, in websocket_check
    assert self.voice_client.ws.open
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/discord/MusicBot/musicbot/player.py", line 291, in websocket_check
    await self.bot.reconnect_voice_client(self.voice_client.channel.server)
  File "/home/discord/MusicBot/musicbot/bot.py", line 310, in reconnect_voice_client
    new_vc = await self.get_voice_client(vc.channel)
  File "/home/discord/MusicBot/musicbot/bot.py", line 237, in get_voice_client
    s_id_data = await asyncio.wait_for(s_id, timeout=10, loop=self.loop)
  File "/usr/local/lib/python3.5/asyncio/tasks.py", line 396, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 4014, reason = Disconnected..

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/site-packages/discord/voice_client.py", line 272, in poll_voice_ws
    yield from self.ws.poll_event()
  File "/usr/local/lib/python3.5/site-packages/discord/gateway.py", line 607, in poll_event
    raise ConnectionClosed(e) from e
discord.errors.ConnectionClosed: WebSocket connection is closed: code = 4014, reason = Disconnected..
[Debug] Voice websocket is CLOSED, reconnecting

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Summoning the bot doesn’t work when this happens. I have to restart the bot for it to return to the channel.