Merge pull request #6 from vveeps/track-eq

This commit is contained in:
Clxud 2021-10-06 16:08:18 -04:00 committed by GitHub
commit fe1e49182b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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