From a57487e45077114f30404d944772e7dd56a935a0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 17 Apr 2026 19:40:58 +0200 Subject: fix voice even more Signed-off-by: salmonik --- cogs/music/play_commands.py | 4 ++-- cogs/voice.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cogs/music/play_commands.py b/cogs/music/play_commands.py index a24169f..e90d85f 100644 --- a/cogs/music/play_commands.py +++ b/cogs/music/play_commands.py @@ -109,7 +109,7 @@ class PlayCommands(commands.Cog): if len(display) > 90: display = display[:87] + "..." - choices.append(OptionChoice(display[:100], display[:100])) + choices.append(OptionChoice(display[:100], url)) if len(choices) >= 25: break @@ -167,7 +167,7 @@ class PlayCommands(commands.Cog): self, ctx: discord.ApplicationContext, file: str, compressed: bool ) -> None: """Handle file playback from copyparty URL.""" - url = self.path_mapping.get(file, file) + url = file # The option value is now the URL directly if compressed: await self._handle_compressed_file_play(ctx, url) 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: audio_source = discord.PCMVolumeTransformer(audio_source) audio_source.volume = volume - voice_client.play(audio_source) - - while voice_client.is_playing(): - await asyncio.sleep(0.1) - return True + try: + voice_client.play(audio_source) + while voice_client.is_playing(): + await asyncio.sleep(0.1) + return True + except Exception as e: + logger.error(f"Error playing audio: {e}") + return False async def stop(self, guild): """Stop playing and disconnect from voice.""" -- cgit v1.2.3