diff options
| author | Rapptz <[email protected]> | 2016-06-20 01:05:28 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-06-20 01:05:28 -0400 |
| commit | 102e8aca437ed2ac77df3ffc4ff696a6a17bf119 (patch) | |
| tree | fe69d7f9b867aa7e5bc28d11c29b423aae8ea215 | |
| parent | Add FAQ entry for `after` being called right away. (diff) | |
| download | discord.py-102e8aca437ed2ac77df3ffc4ff696a6a17bf119.tar.xz discord.py-102e8aca437ed2ac77df3ffc4ff696a6a17bf119.zip | |
Raise TypeError if "after" parameter is not a callable.
| -rw-r--r-- | discord/voice_client.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py index 9414bda0..c5b24a77 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -74,6 +74,9 @@ class StreamPlayer(threading.Thread): self.delay = encoder.frame_length / 1000.0 self._volume = 1.0 + if after is not None and not callable(after): + raise TypeError('Expected a callable for the "after" parameter.') + def run(self): self.loops = 0 self._start = time.time() @@ -104,7 +107,7 @@ class StreamPlayer(threading.Thread): def stop(self): self._end.set() - if callable(self.after): + if self.after is not None: try: self.after() except: |