discord.py radio bot

код:

@client.command(pass_context=True)
async def radio(ctx):
  global voice
  global msg
  try:
    voice.stop()
    voice.play(FFmpegPCMAudio("http://air.radiorecord.ru:8101/rr_320"))
  except:
    pass
  server_id = ctx.message.guild.id
  col.update_one({"_id": server_id}, {"$set": {"count": 0}})
  channel = ctx.message.author.voice.channel
  voice = get(client.voice_clients, guild = ctx.guild)
  if voice and voice.is_connected():
    await voice.move_to(channel)
  else:
    voice = await channel.connect()
  voice.stop()
  voice.play(FFmpegPCMAudio('http://air.radiorecord.ru:8101/rr_320'))
  emb = discord.Embed(title = "Radio: Record", description = "" , colour = discord.Color.green())
  emb.set_thumbnail(url="https://cdn.discordapp.com/attachments/770170016007847966/797112181283225620/2021-01-08_213941.png")
  msg = await ctx.send(embed=emb)
  hb = msg.id
  hb = str(hb)
  hb += "r"
  print(f"HB: {hb}")
  await msg.add_reaction("⬅️")
  await msg.add_reaction("➡️")
  await msg.add_reaction("⏸️")
  await msg.add_reaction("▶️")
  col.update_one({"_id": server_id}, {"$set": {"msg": hb}})
  print("No Con")

Ошибка:

websocket connection is closing.
Exception in voice thread Thread-11
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 598, in run
    self._do_run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 591, in _do_run
    play_audio(data, encode=not self.source.is_opus())
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 635, in send_audio_packet
    self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
TypeError: str, bytes or bytearray expected, not NoneType
websocket connection is closing.
Exception in voice thread Thread-12
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 598, in run
    self._do_run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/player.py", line 591, in _do_run
    play_audio(data, encode=not self.source.is_opus())
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 635, in send_audio_packet
    self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
TypeError: str, bytes or bytearray expected, not NoneType

Ответы (0 шт):