devoxin / Lavalink.py

A wrapper for Lavalink in Python, which aims to be powerful and intuitive.
https://lavalink.readthedocs.io/
MIT License
225 stars 96 forks source link

Getting AttributeError: 'AudioTrack' object has no attribute 'get' #120

Closed Ariz-z closed 2 years ago

Ariz-z commented 2 years ago

Hey i am using lavalink V4 and i am getting this error

Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\disnake\client.py", line 515, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\logs.py", line 147, in on_command_error
    raise error
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\disnake\ext\commands\core.py", line 169, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\new_music.py", line 458, in play
    track = ImageTrack(data=track, requester=ctx.author.id, image=await self.get_soundcloud_artwork(track["info"]["uri"]))
  File "C:\Users\nirma\Desktop\new-discord-bot\cogs\new_music.py", line 20, in __init__
    super().__init__(data, requester, **extra)
  File "C:\Users\nirma\AppData\Roaming\Python\Python310\site-packages\lavalink\models.py", line 78, in __init__
    info = data.get('info', data)
AttributeError: 'AudioTrack' object has no attribute 'get'

code

class ImageTrack(lavalink.models.AudioTrack):
    def __init__(self, data: dict, requester: int, **extra):
        super().__init__(data, requester, **extra)
        self.image = extra['image']

here is the image of lavalink code image

devoxin commented 2 years ago

This should be fixed in 1283038. Alternatively, please avoid passing an AudioTrack instance to AudioTrack().