diff options
Diffstat (limited to '')
| -rw-r--r-- | cogs/voice.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cogs/voice.py b/cogs/voice.py index 316de7b..b6b504a 100644 --- a/cogs/voice.py +++ b/cogs/voice.py | |||
| @@ -94,11 +94,14 @@ class VoiceManager: | |||
| 94 | audio_source = discord.PCMVolumeTransformer(audio_source) | 94 | audio_source = discord.PCMVolumeTransformer(audio_source) |
| 95 | audio_source.volume = volume | 95 | audio_source.volume = volume |
| 96 | 96 | ||
| 97 | voice_client.play(audio_source) | 97 | try: |
| 98 | 98 | voice_client.play(audio_source) | |
| 99 | while voice_client.is_playing(): | 99 | while voice_client.is_playing(): |
| 100 | await asyncio.sleep(0.1) | 100 | await asyncio.sleep(0.1) |
| 101 | return True | 101 | return True |
| 102 | except Exception as e: | ||
| 103 | logger.error(f"Error playing audio: {e}") | ||
| 104 | return False | ||
| 102 | 105 | ||
| 103 | async def stop(self, guild): | 106 | async def stop(self, guild): |
| 104 | """Stop playing and disconnect from voice.""" | 107 | """Stop playing and disconnect from voice.""" |
