Skip to content

Commit 5e74e22

Browse files
committed
BroadcasterSubscriptions accounts for user_ids param
1 parent ff02ae1 commit 5e74e22

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

twitchio/models/subscriptions.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,23 @@ def __repr__(self) -> str:
137137
class BroadcasterSubscriptions:
138138
"""Represents all the users that subscribe to a broadcaster.
139139
140+
.. note::
141+
total and points are `None` if `user_ids` is provided.
142+
140143
Attributes
141144
----------
142145
subscriptions: HTTPAsyncIterator[BroadcasterSubscription]
143146
HTTPAsyncIterator of [`BroadcasterSubscription`][] objects.
144-
total: int
145-
The total number of users that subscribe to this broadcaster.
146-
points: int
147+
total: int | None
148+
The total number of users that subscribe to this broadcaster. This is `None` if `user_ids` is provided.
149+
points: int | None
147150
The current number of subscriber points earned by this broadcaster.
148151
Points are based on the subscription tier of each user that subscribes to this broadcaster.
149152
150153
For example, a Tier 1 subscription is worth 1 point, Tier 2 is worth 2 points, and Tier 3 is worth 6 points.
151154
The number of points determines the number of emote slots that are unlocked for the broadcaster (see `Subscriber Emote Slots <https://help.twitch.tv/s/article/subscriber-emote-guide#emoteslots>`_).
155+
156+
This is `None` if `user_ids` is provided.
152157
"""
153158

154159
__slots__ = (
@@ -159,8 +164,8 @@ class BroadcasterSubscriptions:
159164

160165
def __init__(self, data: BroadcasterSubscriptionsResponse, iterator: HTTPAsyncIterator[BroadcasterSubscription]) -> None:
161166
self.subscriptions: HTTPAsyncIterator[BroadcasterSubscription] = iterator
162-
self.total: int = data["total"]
163-
self.points: int = data["points"]
167+
self.total: int | None = data.get("total")
168+
self.points: int | None = data.get("points")
164169

165170
def __repr__(self) -> str:
166171
return f"<BroadcasterSubscriptions total={self.total} points={self.points}>"

0 commit comments

Comments
 (0)