The code is not executed further after the connection. Disnake

89 Views Asked by At

I have such a slash command for the bot:

    @commands.slash_command(name='radio', description="Music", guild_ids=[])
    async def radio_voice_cmd(self, inter: disnake.CommandInteraction,
                              voice_channel: disnake.VoiceChannel = commands.Param(description="Channel")):
        await inter.response.defer()
        source = FFmpegPCMAudio('http://stream.radioparadise.com')
        voice_client = await voice_channel.connect()
        await voice_client.play(source)
        print("Connected")
        await inter.edit_original_message(content="Успешно!")

Connect the bot to voice channels and play music. But after voice_client = await voice_channel.connect() the code does not work further

1

There are 1 best solutions below

3
invisible boi On

This might occur if the bot doesn't have permission, or a different type of error. You can check this article to understand how to handle errors: https://guide.disnake.dev/popular-topics/errors