Discord.py Бот отключается от голосового
Музыкальный бот отключается через 30 секунд проигрывания музыки
Вот его логи:
[2021-04-25 16:42:25,191] INFO [discord.gateway.identify:403] Shard ID None has sent the IDENTIFY payload.
[2021-04-25 16:42:25,505] INFO [discord.gateway.received_message:500] Shard ID None has connected to Gateway.
[2021-04-25 16:42:27,524] INFO [root.on_ready:15] Logged in as tests
[2021-04-25 16:42:32,171] INFO [discord.voice_client.connect:329] Connecting to voice...
[2021-04-25 16:42:32,224] INFO [discord.voice_client.prepare_handshake:311] Starting voice handshake... (connection attempt 1)
[2021-04-25 16:42:32,542] INFO [discord.voice_client.finish_handshake:315] Voice handshake complete. Endpoint found russia941.discord.media
[2021-04-25 16:42:32,709] INFO [discord.gateway.initial_connection:867] selected the voice protocol for use (xsalsa20_poly1305_lite)
[2021-04-25 16:42:32,736] INFO [discord.gateway.load_secret_key:885] received secret key for voice connection
[2021-04-25 16:43:00,186] INFO [discord.player.cleanup:158] Preparing to terminate ffmpeg process 6372.
[2021-04-25 16:43:00,186] INFO [discord.player.cleanup:170] ffmpeg process 6372 successfully terminated with return code of 0.
[2021-04-25 16:43:00,187] INFO [discord.voice_client.voice_disconnect:304] The voice handshake is being terminated for Channel ID 824687861257338982 (Guild ID 824687860808024115)
[2021-04-25 16:43:00,188] INFO [discord.voice_client.poll_voice_ws:422] Disconnecting from voice normally, close code 1000.
Проигрывания аудио идет через ffmpeg и вполне корректно. Слышал что также следует использует opus для потоковой трансляции звука, но так и не разобрался в этом вопросе, возможно ли, что в этом причина?
Код:
client = ctx.guild.voice_client
state = self.get_state(ctx.guild) # get the guild's state
if client and client.channel:
try:
video = Video(url, ctx.author)
except youtube_dl.DownloadError as e:
logging.warn(f"Ошибка при скачивании видео: {e}")
return
state.playlist.append(video)
message = await ctx.send(
"Добавлено в очередь.", embed=video.get_embed())
await self._add_reaction_controls(message)
else:
if ctx.author.voice is not None and ctx.author.voice.channel is not None:
channel = ctx.author.voice.channel
try:
video = Video(url, ctx.author)
except youtube_dl.DownloadError as e:
return
client = await channel.connect()
self._play_song(client, state, video)
message = await ctx.send("", embed=video.get_embed())
await self._add_reaction_controls(message)
logging.info(f"Сейчас играет: '{video.title}'")
else:
raise commands.CommandError(
"Необходимо подключиться к голосовому каналу.")