mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-30 08:59:36 +00:00
Detect completed drops via notifications feed
This commit is contained in:
15
twitch.py
15
twitch.py
@@ -790,6 +790,9 @@ class Twitch:
|
||||
self.websocket.add_topics([
|
||||
WebsocketTopic("User", "Drops", auth_state.user_id, self.process_drops),
|
||||
WebsocketTopic("User", "CommunityPoints", auth_state.user_id, self.process_points),
|
||||
WebsocketTopic(
|
||||
"User", "Notifications", auth_state.user_id, self.process_notifications
|
||||
),
|
||||
])
|
||||
full_cleanup: bool = False
|
||||
channels: Final[OrderedDict[int, Channel]] = self.channels
|
||||
@@ -1391,6 +1394,18 @@ class Twitch:
|
||||
self._drop_update.set_result(False)
|
||||
self._drop_update = None
|
||||
|
||||
@task_wrapper
|
||||
async def process_notifications(self, user_id: int, message: JsonType):
|
||||
if message["type"] == "create-notification":
|
||||
data: JsonType = message["data"]["notification"]
|
||||
if data["type"] == "user_drop_reward_reminder_notification":
|
||||
self.change_state(State.INVENTORY_FETCH)
|
||||
await self.gql_request(
|
||||
GQL_OPERATIONS["NotificationsDelete"].with_variables(
|
||||
{"input": {"id": data["id"]}}
|
||||
)
|
||||
)
|
||||
|
||||
@task_wrapper
|
||||
async def process_points(self, user_id: int, message: JsonType):
|
||||
# Example payloads:
|
||||
|
||||
Reference in New Issue
Block a user