add Track.__eq__

This commit is contained in:
vveeps 2021-10-06 23:01:22 +03:00
parent adbec06613
commit ece289b051
1 changed files with 9 additions and 0 deletions

View File

@ -30,6 +30,15 @@ class Track:
self.is_seekable = info.get("isSeekable") self.is_seekable = info.get("isSeekable")
self.position = info.get("position") self.position = info.get("position")
def __eq__(self, other):
if not isinstance(other, Track):
return False
if self.ctx and other.ctx:
return other.track_id == self.track_id and other.ctx.message.id == self.ctx.message.id
return other.track_id == self.track_id
def __str__(self): def __str__(self):
return self.title return self.title