Closed Gregorein closed 4 months ago
Possibly related to https://github.com/Teekeks/pyTwitchAPI/issues/312
following example from the other issue, I've implemented a temp fix #312
async def _handle_notification(self, data: dict):
self._reset_timeout()
_payload = data.get('payload', {})
sub_id = _payload.get('subscription', {}).get('id')
callback = self._callbacks.get(sub_id)
if callback is None:
self.logger.error(f'received event for unknown subscription with ID {sub_id}')
else:
# hacky fix for predictions
if _payload["subscription"]["type"] in ["channel.prediction.end", "channel.prediction.lock"]:
for each in _payload["event"]["outcomes"]:
del each["top_predictors"]
t = self._callback_loop.create_task(callback['callback'](callback['event'](**_payload)))
t.add_done_callback(self._task_callback)
Oh, I just realized that I tested this in my dev version and not the release version. I fixed this in 3344ff67a084dfd62b748507ec57168f71f8d139 which is part of the next release. Will do a bugfix release out of this rn.
Fix for this is now available on pypi in v4.2.1.
When mocking twitch websocket I've encountered the following error:
The error occurs when
listen_channel_prediction_end()
is hit with a matching eventThis is the testrunner log:
(subscription json was formatted for easier debug)
I'm tinkering with the library code, but I'm not sure where to fix it yet, help welcome :)