PythonistaGuild / Wavelink

A powerful Lavalink library for Discord.py.
https://wavelink.dev
MIT License
389 stars 179 forks source link

Unexpected error occured while connecting Node #257

Closed LobaaChe closed 9 months ago

LobaaChe commented 9 months ago

An unexpected error occurred while connecting Node(identifier=, uri=, status=NodeStatus.CONNECTING, players=0) to Lavalink: "'Music' object has no attribute 'user'" If this error persists or wavelink is unable to reconnect, please see: https://github.com/PythonistaGuild/Wavelink/issues

chillymosh commented 9 months ago

@LobaaChe Have you just upgraded to wavelink 3.x from 2.x? If so there are many things that you will need to change. You need Lavalink 4 as a minimum and many of the attributes and methods have changed.

If you could provide any code if this is not the case then it would be most helpful in assisting.

LobaaChe commented 9 months ago

@LobaaChe Have you just upgraded to wavelink 3.x from 2.x? If so there are many things that you will need to change. You need Lavalink 4 as a minimum and many of the attributes and methods have changed.

If you could provide any code if this is not the case then it would be most helpful in assisting.

Yeah I upgraded to wavelink 3.0 and I run lavalink 4.0.0-beta.5

Here's code for my music cog (it's pretty long, sorry): music.txt

chillymosh commented 9 months ago

You should not really be using bot.loop.create_task(self.setup_hook()) for wavelink 3, ideally it should be the setup_hook in the main Bot subclass that gets called automatically on startup by discord.py If you want to separate it into a cog though then you should use cog_load inside Music instead of setup_hook (Doesn't exist in a cog) then you don't need to create_task. I usually do not recommend this way (and prefer setup_hook in Bot class) due to race conditions.

I believe your issue here though is due to the connect, try changing to the below.

await wavelink.Pool.connect(nodes = nodes, client=self.bot, cache_capacity = 100)
LobaaChe commented 9 months ago

The problem was indeed in that line, very silly of me. Thank you, it works now!