-3

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

invisible boi
  • 106
  • 1
  • 8
Angeloffy
  • 1
  • 1

1 Answers1

0

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

invisible boi
  • 106
  • 1
  • 8
  • The bot successfully connects to the voice channel, there are no errors in the console. After connecting, the code does not want to be executed further .-. – Angeloffy Aug 05 '23 at 22:38
  • @Angeloffy discord.py by default doesn't output errors to console, they are handled using a special function. by what you said, it seems that the problem is `await voice_channel.play(source)` the FFmpegPCMAudio function isn't working properly – invisible boi Aug 05 '23 at 23:02
  • or again, the bot doesnt have permission to play sound – invisible boi Aug 05 '23 at 23:02