Skip to content

Commit

Permalink
Experimental drops_enabled via AvailableDrops
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilXD committed Oct 15, 2023
1 parent 5e862f9 commit 163a056
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,15 @@ async def get_stream(self) -> Stream | None:
self._display_name = stream_data["displayName"]
if not stream_data["stream"]:
return None
return Stream.from_get_stream(self, stream_data)
stream = Stream.from_get_stream(self, stream_data)
available_drops: JsonType = await self._twitch.gql_request(
GQL_OPERATIONS["AvailableDrops"].with_variables({"channelID": str(self.id)})
)
stream.drops_enabled = any(
bool(c["timeBasedDrops"])
for c in available_drops["data"]["channel"]["viewerDropCampaigns"]
)
return stream

async def update_stream(self, *, trigger_events: bool) -> bool:
"""
Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def with_variables(self, variables: JsonType) -> GQLOperation:
},
),
# returns drops available for a particular channel (unused)
"ChannelDrops": GQLOperation(
"AvailableDrops": GQLOperation(
"DropsHighlightService_AvailableDrops",
"9a62a09bce5b53e26e64a671e530bc599cb6aab1e5ba3cbd5d85966d3940716f",
variables={
Expand Down

0 comments on commit 163a056

Please sign in to comment.