diff options
| author | salmonik <raisersoft@proton.me> | 2026-04-17 19:40:58 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-04-17 19:40:58 +0200 |
| commit | a57487e45077114f30404d944772e7dd56a935a0 (patch) | |
| tree | 4c63a8b6ff3581f6bdd3edaa128c46a7d9338b63 /cogs | |
| parent | add qr generation and decoding (diff) | |
| download | senator-sperma-a57487e45077114f30404d944772e7dd56a935a0.tar.gz senator-sperma-a57487e45077114f30404d944772e7dd56a935a0.zip | |
fix voice even more
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/play_commands.py | 4 | ||||
| -rw-r--r-- | 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): | |||
| 109 | if len(display) > 90: | 109 | if len(display) > 90: |
| 110 | display = display[:87] + "..." | 110 | display = display[:87] + "..." |
| 111 | 111 | ||
| 112 | choices.append(OptionChoice(display[:100], display[:100])) | 112 | choices.append(OptionChoice(display[:100], url)) |
| 113 | 113 | ||
| 114 | if len(choices) >= 25: | 114 | if len(choices) >= 25: |
| 115 | break | 115 | break |
| @@ -167,7 +167,7 @@ class PlayCommands(commands.Cog): | |||
| 167 | self, ctx: discord.ApplicationContext, file: str, compressed: bool | 167 | self, ctx: discord.ApplicationContext, file: str, compressed: bool |
| 168 | ) -> None: | 168 | ) -> None: |
| 169 | """Handle file playback from copyparty URL.""" | 169 | """Handle file playback from copyparty URL.""" |
| 170 | url = self.path_mapping.get(file, file) | 170 | url = file # The option value is now the URL directly |
| 171 | 171 | ||
| 172 | if compressed: | 172 | if compressed: |
| 173 | await self._handle_compressed_file_play(ctx, url) | 173 | 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: | |||
| 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.""" |
