Skip to content

Commit

Permalink
Fix stream game id and name being empty strings instead of None
Browse files Browse the repository at this point in the history
Followup to #478 since I incorrectly assumed these are nullable

Signed-off-by: Lilly Rose Berner <[email protected]>
  • Loading branch information
LostLuma committed Dec 24, 2024
1 parent 23828bc commit 4793f6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions twitchio/models/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def __init__(self, data: StreamsResponseData, *, http: HTTPClient) -> None:

self.id: str = data["id"]
self.user = PartialUser(data["user_id"], data["user_login"], data["user_name"], http=http)
self.game_id: str | None = data["game_id"]
self.game_name: str | None = data["game_name"]
self.game_id: str | None = data["game_id"] or None
self.game_name: str | None = data["game_name"] or None
self.type: str = data["type"]
self.title: str = data["title"]
self.viewer_count: int = data["viewer_count"]
Expand Down
5 changes: 3 additions & 2 deletions twitchio/types_/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,8 +1451,9 @@ class StreamsResponseData(TypedDict):
user_id: str
user_login: str
user_name: str
game_id: str | None
game_name: str | None
# Game ID and name are empty when no category is set
game_id: str
game_name: str
type: Literal["live", ""]
title: str
tags: list[str]
Expand Down

0 comments on commit 4793f6a

Please sign in to comment.