#Voice Support

1 messages · Page 1 of 1 (latest)

forest lily
#

Hi,

already = []

@slash_command("play")
async def play(ctx:SlashContext):
    if not ctx.voice_state:
        await ctx.author.voice.channel.connect()
    if len(already) == 114:
        already.clear()
    if already:
        surah = quran[already.index(already[-1]) + 1]
    else:
        surah = quran[0]
    
    surah_sound = random.choice(surah["sounds"])
    sound_name = surah_sound["name"]
    sound_url = surah_sound["url"]
    surah_name = surah["surah"]
    title = f"{surah_name} | {sound_name}"
    #ss = requests.get(sound_url,allow_redirects=True)
    #with open(f"{sound_name}.wav","wb") as f:
        #f.write(ss.content)
    audio = AudioVolume("عبد الرحمن السديس.wav")
    await ctx.send(f"{title}")
    await ctx.voice_state.play(audio)
Task exception was never retrieved
future: <Task finished name='Task-65' coro=<ActiveVoiceState._ws_connect() done, defined at C:\Users\ALMWSHOOR\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\models\internal\active_voice_state.py:105> exception=VoiceWebSocketClosed('The Websocket closed with code: 4020 - Unknown Error')>
Traceback (most recent call last):
  File "C:\Users\ALMWSHOOR\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\models\internal\active_voice_state.py", line 109, in _ws_connect
    await self.ws.run()
  File "C:\Users\ALMWSHOOR\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\api\voice\voice_gateway.py", line 85, in run
    msg = await receiving
          ^^^^^^^^^^^^^^^
  File "C:\Users\ALMWSHOOR\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\api\voice\voice_gateway.py", line 121, in receive
    raise VoiceWebSocketClosed(resp.data)
interactions.client.errors.VoiceWebSocketClosed: The Websocket closed with code: 4020 - Unknown Error

I run pip install discord.py-interactions[voice] again and that help me with nothing

delicate daggerBOT
#

Hey! Once your issue is solved, press the button below to close this thread!