Skip to content

Commit 0759081

Browse files
committed
2 parents 1f0b73a + 5b7fec2 commit 0759081

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

twitchio/models/channels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ def __init__(self, data: ChannelInformationResponseData, *, http: HTTPClient) ->
218218
def __repr__(self) -> str:
219219
return f"<ChannelInfo user={self.user} game_id={self.game_id} game_name={self.game_name} title={self.title} language={self.language} delay={self.delay}>"
220220

221-
async def fetch_game(self) -> Game:
221+
async def fetch_game(self) -> Game | None:
222222
"""|coro|
223223
224224
Fetches the :class:~twitchio.Game` associated with this ChannelInfo.
225225
226226
Returns
227227
-------
228-
Game
228+
Game | None
229229
The game associated with this ChannelInfo.
230230
"""
231231
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
232-
return Game(payload["data"][0], http=self._http)
232+
return Game(payload["data"][0], http=self._http) if payload["data"] else None

twitchio/models/clips.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,18 @@ def __repr__(self) -> str:
125125
def __str__(self) -> str:
126126
return self.id
127127

128-
async def fetch_game(self) -> Game:
128+
async def fetch_game(self) -> Game | None:
129129
"""|coro|
130130
131131
Fetches the :class:`~twitchio.Game` associated with this Clip.
132132
133133
Returns
134134
-------
135-
Game
135+
Game | None
136136
The game associated with this Clip.
137137
"""
138138
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
139-
return Game(payload["data"][0], http=self._http)
139+
return Game(payload["data"][0], http=self._http) if payload["data"] else None
140140

141141
async def fetch_video(self) -> Video | None:
142142
"""|coro|

twitchio/models/entitlements.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ def __repr__(self) -> str:
9393
def __str__(self) -> str:
9494
return self.id
9595

96-
async def fetch_game(self) -> Game:
96+
async def fetch_game(self) -> Game | None:
9797
"""|coro|
9898
9999
Fetches the :class:`~twitchio.Game` associated with this drop entitlement.
100100
101101
Returns
102102
-------
103-
Game
103+
Game | None
104104
The game associated with this drop entitlement.
105105
"""
106106
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
107-
return Game(payload["data"][0], http=self._http)
107+
return Game(payload["data"][0], http=self._http) if payload["data"] else None
108108

109109

110110
class EntitlementStatus:

twitchio/models/search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(self, data: SearchChannelsResponseData, *, http: HTTPClient) -> Non
9696
def __repr__(self) -> str:
9797
return f"<SearchChannel broadcaster={self.broadcaster} title={self.title} live={self.live} game_id={self.game_id}>"
9898

99-
async def fetch_game(self) -> Game:
99+
async def fetch_game(self) -> Game | None:
100100
"""|coro|
101101
102102
Fetches the :class:`~twitchio.Game` associated with this channel.
@@ -110,4 +110,4 @@ async def fetch_game(self) -> Game:
110110
The game associated with this :class:`~twitchio.SearchChannel` instance.
111111
"""
112112
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
113-
return Game(payload["data"][0], http=self._http)
113+
return Game(payload["data"][0], http=self._http) if payload["data"] else None

0 commit comments

Comments
 (0)