Skip to content

Commit 33195ed

Browse files
author
cdwpx
authored
Bug fixes in models.py (#125)
* Fix bugs Corrects the requester and also fixes start_time and end_time * oops * Fixed bugs Corrected requester and also fixed start_time and end_time
1 parent b7efa99 commit 33195ed

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lavalink/models.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ def __getitem__(self, name):
112112
return super().__getattribute__(name)
113113

114114
@property
115-
def requester(self):
115+
def requester(self) -> int:
116116
return self.extra['requester']
117117

118+
@requester.setter
119+
def requester(self, requester) -> int:
120+
self.extra['requester'] = requester
121+
118122
def __repr__(self):
119123
return '<AudioTrack title={0.title} identifier={0.identifier}>'.format(self)
120124

@@ -359,8 +363,8 @@ async def play_track(self, track: str, start_time: Optional[int] = None, end_tim
359363
options['startTime'] = start_time
360364

361365
if end_time is not None:
362-
if not isinstance(end_time, int) or end_time <= 0:
363-
raise ValueError('end_time must be an int with a value greater than 0')
366+
if not isinstance(end_time, int) or not end_time <= 0:
367+
raise ValueError('end_time must be an int with a value equal to, or greater than 0')
364368

365369
if end_time > 0:
366370
options['endTime'] = end_time
@@ -696,12 +700,12 @@ async def play(self, track: Optional[Union[AudioTrack, DeferredAudioTrack, Dict]
696700
track = self.queue.pop(pop_at)
697701

698702
if start_time is not None:
699-
if not isinstance(start_time, int) or 0 <= start_time < track.duration:
703+
if not isinstance(start_time, int) or not 0 <= start_time < track.duration:
700704
raise ValueError('start_time must be an int with a value equal to, or greater than 0, and less than the track duration')
701705

702706
if end_time is not None:
703-
if not isinstance(end_time, int) or 0 < end_time <= track.duration:
704-
raise ValueError('end_time must be an int with a value greater than 0, and less than, or equal to the track duration')
707+
if not isinstance(end_time, int) or not 0 <= end_time <= track.duration:
708+
raise ValueError('end_time must be an int with a value equal to, or greater than 0, and less than, or equal to the track duration')
705709

706710
self.current = track
707711
playable_track = track.track

0 commit comments

Comments
 (0)