Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Revert "Improve the connect, move, and is_connected methods" #38

Merged
merged 1 commit into from Feb 16, 2022
Merged

Revert "Improve the connect, move, and is_connected methods" #38

merged 1 commit into from Feb 16, 2022

Conversation

OmLanke
Copy link
Contributor

@OmLanke OmLanke commented Feb 16, 2022

Reverts #34

The library seems to have broken after the mentioned PR. 1 previous version works perfectly without any code changes

Error-

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 179, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/container/Cogs/Music.py", line 142, in play
    await vc.play(vc.queue.get())
  File "/home/container/.local/lib/python3.10/site-packages/pycord/wavelink/player.py", line 247, in play
    "guildId": str(self.guild.id),
  File "/home/container/.local/lib/python3.10/site-packages/pycord/wavelink/player.py", line 107, in guild
    return self.channel.guild
AttributeError: 'NoneType' object has no attribute 'guild'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 335, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 916, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 188, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'guild'

@Lulalaby Lulalaby merged commit 9e1fbe4 into Pycord-Development:main Feb 16, 2022
@KosmicAnomaly
Copy link
Contributor

KosmicAnomaly commented Feb 17, 2022

I'm not sure what is causing that error, I didn't encounter it while testing. The traceback doesn't show any reference to the code I changed, could you show me the part that is causing the error?

Edit: I think I figured out what the issue is. You probably tried to connect the bot to a channel, but the end result was that the bot did not end up in the channel it was trying to connect to. This resulted in the following lines being triggered (this is intentional).

self._connected = False
self.channel = None

It would probably be a good idea for you to check if the connection was successful by checking if player.channel is not None, and then moving forward with what you need to do depending on if it connected or not.

@OmLanke
Copy link
Contributor Author

OmLanke commented Feb 17, 2022

It's the self.channel part that is having issues. Your pr did changes to that.

If you read the traceback, you can see that self.channel is having a None value

If you try to disconnect the channel, it says Not connected to a voice channel

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants