Skip to content

Commit ebaa1c2

Browse files
committed
Add Video and Stream eq
1 parent 74c95c9 commit ebaa1c2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

twitchio/models/streams.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ async def fetch_game(self) -> Game | None:
135135
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
136136
return Game(payload["data"][0], http=self._http) if payload["data"] else None
137137

138+
def __eq__(self, other: object) -> bool:
139+
if not isinstance(other, Stream):
140+
return NotImplemented
141+
142+
return self.id == other.id and self.started_at == other.started_at
143+
138144

139145
class StreamMarker:
140146
"""Represents a stream marker.

twitchio/models/videos.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,9 @@ async def delete(self, token_for: str) -> None:
117117
A user oauth token with the ``channel:manage:videos`` scope.
118118
"""
119119
await self._http.delete_videos(ids=[self.id], token_for=token_for)
120+
121+
def __eq__(self, other: object) -> bool:
122+
if not isinstance(other, Video):
123+
return NotImplemented
124+
125+
return self.id == other.id

0 commit comments

Comments
 (0)