Making a Discord Bot Connect to a Voice Channel

I am trying to configure my Discord bot to connect to a Voice Channel, but I face an issue where it does not respond, and I don’t receive any errors. I have explored various solutions from forums, but none have resolved my issue. Here’s one example of my implementation:

bot = commands.Bot(command_prefix='!')
@bot.command()
async def join_voice(ctx):
    voice_channel = ctx.author.voice.channel
    await voice_channel.connect()

Hey, I think it could be related to the bot’s permissions. make sure ur bot has permission to ‘Connect’ and ‘Speak’ in the voice channel ur trying to join. Also, check if it’s not already connected to another voice channel, sometimes that’s the issue. hope this helps!