#BOT won't connect to Voice Channel

1 messages · Page 1 of 1 (latest)

orchid shuttle
#

Code

@bot.slash_command(name="play" , description="Plays Songs")
async def play(ctx, url : str):
    song_there = os.path.isfile("song.mp3")
    
    try:
        if song_there:
            os.remove("song.mp3")
    except PermissionError:
        await ctx.send("Wait for the current playing music to end or use the 'stop' command")
        return
    
    voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General')
    print(voiceChannel)
    await voiceChannel.connect()
    voice = discord.utils.get(bot.voice_clients, guild=ctx.guild)
    

    song=ytaudio(url)
    voice.play(discord.FFmpegPCMAudio(song))

I don't get what I am doing wrong here

#

I get not Exceptions that I can work off so I am basically stuck

visual cosmos
#

so you're not getting any errors in console?

orchid shuttle
#

No errors

#

on discord interaction just fails

visual cosmos
#

then it should be because of your exception in line 8

orchid shuttle
#

exceptions

visual cosmos
#

if you get no errors in console

orchid shuttle
#

a few lines under that there is a print commad

#

that works just fine

#

it prints the VC channel in my server

visual cosmos
#

so your bot only can't connect to channel, right?

#

@orchid shuttle

orchid shuttle
#

Yes

#

it won't conenct

visual cosmos
#

maybe then try to replace finding channel with utils and voiceChannel.connect() with await ctx.author.voice.channel.connect()

#

it's my last idea

orchid shuttle
#

okay

#

thanks

#

lemme try

orchid shuttle
#

it is unable to connect foe some reason and won't even throw a error

#

@visual cosmos Funniest thing ever. I didn't install pycord with Voice support