Skip to content

Commit 2a17329

Browse files
committed
Update tiers to be Literal instead of string.
1 parent 5e74e22 commit 2a17329

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

twitchio/models/eventsub_.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ class ChannelSubscribe(BaseEvent):
17831783
The broadcaster whose channel received a subscription.
17841784
user: PartialUser
17851785
The user who subscribed to the channel.
1786-
tier: str
1786+
tier: typing.Literal["1000", "2000", "3000"]
17871787
The tier of the subscription. Valid values are 1000, 2000, and 3000.
17881788
gift: bool
17891789
Whether the subscription is a gift.
@@ -1820,7 +1820,7 @@ class ChannelSubscriptionEnd(BaseEvent):
18201820
The broadcaster whose channel had the subscription end.
18211821
user: PartialUser
18221822
The user whose subscription ended.
1823-
tier: str
1823+
tier: typing.Literal["1000", "2000", "3000"]
18241824
The tier of the subscription that ended. Valid values are 1000, 2000, and 3000.
18251825
gift: bool
18261826
Whether the subscription was a gift.
@@ -1840,7 +1840,7 @@ def __init__(self, payload: ChannelSubscriptionEndEvent, *, http: HTTPClient) ->
18401840
payload["broadcaster_user_id"], payload["broadcaster_user_login"], payload["broadcaster_user_name"], http=http
18411841
)
18421842
self.user: PartialUser = PartialUser(payload["user_id"], payload["user_login"], payload["user_name"], http=http)
1843-
self.tier: str = payload["tier"]
1843+
self.tier: Literal["1000", "2000", "3000"] = payload["tier"]
18441844
self.gift: bool = bool(payload["is_gift"])
18451845

18461846
def __repr__(self) -> str:
@@ -1857,7 +1857,7 @@ class ChannelSubscriptionGift(BaseEvent):
18571857
The broadcaster whose channel received the gift subscriptions.
18581858
user: PartialUser | None
18591859
The user who sent the gift. `None` if it was an anonymous subscription gift.
1860-
tier: str
1860+
tier: typing.Literal["1000", "2000", "3000"]
18611861
The tier of the subscription that ended. Valid values are 1000, 2000, and 3000.
18621862
total: int
18631863
The number of subscriptions in the subscription gift.
@@ -1881,7 +1881,7 @@ def __init__(self, payload: ChannelSubscriptionGiftEvent, *, http: HTTPClient) -
18811881
if payload["user_id"] is not None
18821882
else None
18831883
)
1884-
self.tier: str = payload["tier"]
1884+
self.tier: Literal["1000", "2000", "3000"] = payload["tier"]
18851885
self.total: int = int(payload["total"])
18861886
self.anonymous: bool = bool(payload["is_anonymous"])
18871887
cumulative_total = payload.get("cumulative_total")
@@ -1934,8 +1934,8 @@ class ChannelSubscriptionMessage(BaseEvent):
19341934
The broadcaster whose channel received a subscription message.
19351935
user: PartialUser
19361936
The user who sent a resubscription chat message.
1937-
tier: str
1938-
The tier of the user's subscription.
1937+
tier: typing.Literal["1000", "2000", "3000"]
1938+
The tier of the user's subscription. Valid values are 1000, 2000, and 3000.
19391939
months: str
19401940
The month duration of the subscription.
19411941
cumulative_months: int
@@ -1958,7 +1958,7 @@ def __init__(self, payload: ChannelSubscribeMessageEvent, *, http: HTTPClient) -
19581958
payload["broadcaster_user_id"], payload["broadcaster_user_login"], payload["broadcaster_user_name"], http=http
19591959
)
19601960
self.user: PartialUser = PartialUser(payload["user_id"], payload["user_login"], payload["user_name"], http=http)
1961-
self.tier: str = payload["tier"]
1961+
self.tier: Literal["1000", "2000", "3000"] = payload["tier"]
19621962
self.months: int = int(payload["duration_months"])
19631963
self.cumulative_months: int = int(payload["cumulative_months"])
19641964
self.streak_months: int | None = int(payload["streak_months"]) if payload["streak_months"] is not None else None

twitchio/types_/eventsub.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ class ChannelSubscribeEvent(BroadcasterUserEvent):
632632

633633

634634
class ChannelSubscriptionEndEvent(BroadcasterUserEvent):
635-
tier: str
635+
tier: Literal["1000", "2000", "3000"]
636636
is_gift: bool
637637

638638

@@ -641,7 +641,7 @@ class ChannelSubscriptionGiftEvent(BaseBroadcasterEvent):
641641
user_login: str | None
642642
user_name: str | None
643643
total: int
644-
tier: str
644+
tier: Literal["1000", "2000", "3000"]
645645
cumulative_total: int | None
646646
is_anonymous: bool
647647

@@ -665,7 +665,7 @@ class SubscribeMessageData(BaseMessageData): ...
665665

666666
class ChannelSubscribeMessageEvent(BroadcasterUserEvent):
667667
total: int
668-
tier: str
668+
tier: Literal["1000", "2000", "3000"]
669669
cumulative_months: int
670670
streak_months: int | None
671671
duration_months: int

0 commit comments

Comments
 (0)