Skip to content

Commit

Permalink
Add Video and Stream eq
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Jan 5, 2025
1 parent 74c95c9 commit ebaa1c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions twitchio/models/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ async def fetch_game(self) -> Game | None:
payload: GamesResponse = await self._http.get_games(ids=[self.game_id])
return Game(payload["data"][0], http=self._http) if payload["data"] else None

def __eq__(self, other: object) -> bool:
if not isinstance(other, Stream):
return NotImplemented

return self.id == other.id and self.started_at == other.started_at


class StreamMarker:
"""Represents a stream marker.
Expand Down
6 changes: 6 additions & 0 deletions twitchio/models/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,9 @@ async def delete(self, token_for: str) -> None:
A user oauth token with the ``channel:manage:videos`` scope.
"""
await self._http.delete_videos(ids=[self.id], token_for=token_for)

def __eq__(self, other: object) -> bool:
if not isinstance(other, Video):
return NotImplemented

return self.id == other.id

0 comments on commit ebaa1c2

Please sign in to comment.