Skip to content

Bot can't connect to voice chat #2833

@PWDSerialgamer07

Description

@PWDSerialgamer07

Summary

When trying to connect to a channel, the bot will hang for some time, then disconnect.

Reproduction Steps

  1. Make the bot connect to a voice channel
  2. It doesn't work

Minimal Reproducible Code

@bot.slash_command(name="join", description="Tells the bot to join the voice channel.")
async def join(interaction: discord.Interaction) -> None:
    user = interaction.user
    await interaction.response.defer()
    if not user.voice:
        await interaction.followup.send(f"{user.name} is not connected to a voice channel.", ephemeral=True)
        return

    channel = user.voice.channel
    try:
         await channel.connect()
    except Exception as e:
         print(e)
    await interaction.followup.send(f"Connected to {channel.name}")

Expected Results

The bot connects to the voice channel

Actual Results

It connects, hangs there for some time then disconnects. Here is all that was outputted to the console:

Unclosed connection
client_connection: Connection<ConnectionKey(host='c-ams15-6ef27d2f.discord.media', port=443, is_ssl=True, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None)>

(that's it, there was nothing else)

Intents

default, voice states and message content

System Information

  • Python v3.11.2-final
  • py-cord v2.6.1-final
  • aiohttp v3.12.14
  • system info: Linux 6.1.0-28-amd64 Update README.rst #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22)

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions