KeyError with on_voice_state_update event
Zenrac opened this issue · 5 comments
Zenrac commented
Task exception was never retrieved
future: <Task finished coro=<WebSocket.listen() done, defined at C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\WebSocket.py:92> exception=KeyError('position',)>
Traceback (most recent call last):
File "C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\WebSocket.py", line 130, in listen
await self._lavalink.update_state(data)
File "C:\Users\Zenrac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lavalink\Client.py", line 62, in update_state
p.position = data['state']['position']
KeyError: 'position'
It seems to happen since I've added an on_voice_state_update
event
I don't really know how to repro
devoxin commented
Can you show your code?
Zenrac commented
I figured out how to repro it :
I've replaced the QueueEndEvent by the following code (in the V3 example) :
elif isinstance(event, lavalink.Events.QueueEndEvent):
player = event.player
if not player.paused:
await player.set_pause(True)
In a way this is stupid to pause the player when no song are queued but it is not supposed to raise a KeyError
AndyTempel commented
Same issue here, no obvious error in custom event processing.
devoxin commented
Looks like Lavalink is possibly sending incomplete data.