Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voice.connect() never returns #9460

Closed
3 tasks done
yuhime opened this issue Jun 22, 2023 · 12 comments
Closed
3 tasks done

voice.connect() never returns #9460

yuhime opened this issue Jun 22, 2023 · 12 comments
Labels
needs info This issue needs more information to be actionable.

Comments

@yuhime
Copy link

yuhime commented Jun 22, 2023

Summary

once the connect function is called the bot connects to the voice channel but the never returns, this blocks the code and is_connected returns false

Reproduction Steps

vc = ctx.voice_client
        
if vc:
  if vc.channel.id == channel.id:
    return
  try:
     await vc.move_to(channel)
     except asyncio.TimeoutError:
     raise VoiceConnectionError(f"Moving to channel: <{channel}> timed out.")
            
  else:
       try:
          await channel.connect(self_deaf=True) # never return
        except asyncio.TimeoutError:
            raise VoiceConnectionError("f'Connecting to channel: <{channel}> timed out.")
         
           ... # the rest of the code is not executed
        

Minimal Reproducible Code

vc = ctx.voice_client
        
if vc:
  if vc.channel.id == channel.id:
    return
  try:
     await vc.move_to(channel)
     except asyncio.TimeoutError:
     raise VoiceConnectionError(f"Moving to channel: <{channel}> timed out.")
            
else:
       try:
          await channel.connect(self_deaf=True) # never return
        except asyncio.TimeoutError:
            raise VoiceConnectionError("f'Connecting to channel: <{channel}> timed out.")
         
           ... # the rest of the code is not executed

Expected Results

await channel.connect(self_deaf=True) # return

print("connected") # executed

Actual Results

await channel.connect(self_deaf=True) # never return

print("connected") # not executed

Intents

intents = discord.Intents.default(); intents.message_content = True

System Information

  • Python v3.10.6-final
  • discord.py v2.3.0-final
  • aiohttp v3.8.3

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

this problem is not always present, sometimes everything works correctly

@yuhime yuhime added the unconfirmed bug A bug report that needs triaging label Jun 22, 2023
@Rapptz
Copy link
Owner

Rapptz commented Jun 22, 2023

Have you checked if you have permissions to connect to the channel

@yuhime
Copy link
Author

yuhime commented Jun 22, 2023

yes, it has all the necessary permits

@Rapptz
Copy link
Owner

Rapptz commented Jun 22, 2023

I'm not seeing it in the code

@Rapptz Rapptz added needs info This issue needs more information to be actionable. and removed unconfirmed bug A bug report that needs triaging labels Jun 22, 2023
@yuhime
Copy link
Author

yuhime commented Jun 22, 2023

bot has administrator permissions, the problem does not always persist, sometimes everything works correctly

@Rapptz
Copy link
Owner

Rapptz commented Jun 22, 2023

People frequently say this and then they check and it isn't true, that's why it's better to have the permission checks in the code.

Anyway, turn on debug logging and check the logs and see if anything pops up. Though it can get pretty spammy. This isn't reproducible as far as I'm aware outside of the scenario I mentioned with permissions.

@yuhime
Copy link
Author

yuhime commented Jun 22, 2023

I have already tried my hand at checking debug logs and anything that could give me information, but I never find anything, nothing is sent, it just hangs. If it were a permissions problem it would never have worked, but instead sometimes it works and sometimes it doesn't.

@Rapptz
Copy link
Owner

Rapptz commented Jun 22, 2023

Then as it stands this issue is unfortunately not actionable. If there's new information or something that can point to something more actionable you are free to open a new issue.

@Rapptz Rapptz closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2023
@revoxhere
Copy link

@yosaki0 any updates on this? I'm having the same issue

@imayhaveborkedit
Copy link
Contributor

This should be fixed with #9525.

@codeofdusk
Copy link

codeofdusk commented Oct 28, 2023

With latest master I'm now seeing this behaviour. Attempting to call connect on a voice channel doesn't return though it does connect successfully. All works fine on 2.3.2.

class MinimalExample(commands.Cog):
    @commands.Cog.listener()
    async def on_voice_state_update(self, member, before, after):
        vc = member.guild.voice_client
        if not vc and after.channel:
            await self._connect(after.channel)

    async def _connect(self, channel):
        if channel.guild.voice_client is None:
            vc = await channel.connect()
            print(vc)  # Never executes

@imayhaveborkedit
Copy link
Contributor

@codeofdusk I can't reproduce this. If this is consistent behavior for you, you should make a new issue with debug log output included.

@codeofdusk
Copy link

@imayhaveborkedit I've opened #9634.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info This issue needs more information to be actionable.
Projects
None yet
Development

No branches or pull requests

5 participants