diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-21 17:10:23 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-21 17:10:23 +0200 |
| commit | 2e614665e0c62fe572b5af53a2a6be1116d66720 (patch) | |
| tree | dbb48ad5d665a3f3d8c793db30a523264f17bcde /cogs/music/play_commands.py | |
| parent | fix naming not resolving things like %20 (diff) | |
| parent | Fix voice reconnect race: reuse VoiceClient instead of destroying it (diff) | |
| download | senator-sperma-2e614665e0c62fe572b5af53a2a6be1116d66720.tar.gz senator-sperma-2e614665e0c62fe572b5af53a2a6be1116d66720.zip | |
Merge pull request 'Voice related fixes, alongside simplifying assistant' (#5) from dev into main
Reviewed-on: https://codeberg.org/salmonik/senator-sperma/pulls/5
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/play_commands.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cogs/music/play_commands.py b/cogs/music/play_commands.py index 80a30ef..c6a55b0 100644 --- a/cogs/music/play_commands.py +++ b/cogs/music/play_commands.py | |||
| @@ -17,10 +17,11 @@ import discord | |||
| 17 | from discord.commands import OptionChoice | 17 | from discord.commands import OptionChoice |
| 18 | from discord.ext import commands | 18 | from discord.ext import commands |
| 19 | 19 | ||
| 20 | from cogs.music import audio_playback, media_processing | 20 | from cogs.music import media_processing |
| 21 | from cogs.utils.file_search import UniversalSearcher | 21 | from cogs.utils.file_search import UniversalSearcher |
| 22 | from cogs.utils.settings import get_uploadurl | 22 | from cogs.utils.settings import get_uploadurl |
| 23 | from cogs.utils.url_helper import clean_url_for_ytdlp | 23 | from cogs.utils.url_helper import clean_url_for_ytdlp |
| 24 | from cogs.voice import get_voice_manager | ||
| 24 | 25 | ||
| 25 | logger = logging.getLogger(__name__) | 26 | logger = logging.getLogger(__name__) |
| 26 | 27 | ||
| @@ -163,7 +164,7 @@ class PlayCommands(commands.Cog): | |||
| 163 | if not compressed_path: | 164 | if not compressed_path: |
| 164 | return | 165 | return |
| 165 | 166 | ||
| 166 | await audio_playback.AudioPlaybackManager.play( | 167 | await get_voice_manager(self.bot).play( |
| 167 | ctx, compressed_path, delete_after_play=True | 168 | ctx, compressed_path, delete_after_play=True |
| 168 | ) | 169 | ) |
| 169 | except Exception as e: | 170 | except Exception as e: |
| @@ -210,7 +211,7 @@ class PlayCommands(commands.Cog): | |||
| 210 | 211 | ||
| 211 | upload_task = asyncio.create_task(self._upload_to_copyparty_async(local_path)) | 212 | upload_task = asyncio.create_task(self._upload_to_copyparty_async(local_path)) |
| 212 | 213 | ||
| 213 | await audio_playback.AudioPlaybackManager.play( | 214 | await get_voice_manager(self.bot).play( |
| 214 | ctx, local_path, delete_after_play=True | 215 | ctx, local_path, delete_after_play=True |
| 215 | ) | 216 | ) |
| 216 | 217 | ||
| @@ -266,7 +267,7 @@ class PlayCommands(commands.Cog): | |||
| 266 | if compressed: | 267 | if compressed: |
| 267 | await self._handle_compressed_file_play(ctx, url) | 268 | await self._handle_compressed_file_play(ctx, url) |
| 268 | else: | 269 | else: |
| 269 | await audio_playback.AudioPlaybackManager.play(ctx, url) | 270 | await get_voice_manager(self.bot).play(ctx, url) |
| 270 | 271 | ||
| 271 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") | 272 | @discord.slash_command(name="grajcuj", description="grajcujmy wszyscy!") |
| 272 | async def play( | 273 | async def play( |
| @@ -301,7 +302,7 @@ class PlayCommands(commands.Cog): | |||
| 301 | if file: | 302 | if file: |
| 302 | file_path: PathLike[str] | str = os.path.join(self.temp_dir, file.filename) | 303 | file_path: PathLike[str] | str = os.path.join(self.temp_dir, file.filename) |
| 303 | await file.save(file_path) | 304 | await file.save(file_path) |
| 304 | await audio_playback.AudioPlaybackManager.play(ctx, file_path) | 305 | await get_voice_manager(self.bot).play(ctx, file_path) |
| 305 | else: | 306 | else: |
| 306 | try: | 307 | try: |
| 307 | if EXTERNAL_URL_PATTERN.match(melodia.lower()): | 308 | if EXTERNAL_URL_PATTERN.match(melodia.lower()): |
