From 4663f260b55de0975661fda1c00f60d2ca6e4506 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 20 May 2026 15:40:18 +0200 Subject: Clean up consumers: replace polling with VoiceManager.play_source() - cron.py: replace while-is_playing polling with VoiceManager.play_source() - vclogs.py: replace while-is_playing polling with VoiceManager.play_source() - stop.py: use VoiceManager.disconnect() instead of raw voice_client - join.py: use VoiceManager.connect() instead of raw channel.connect() - voice.py: add back join_by_channel_id() convenience method - Tests: update for new VoiceManager method names and signatures --- cogs/music/join.py | 4 +++- cogs/music/stop.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'cogs/music') diff --git a/cogs/music/join.py b/cogs/music/join.py index c613b10..d68ca79 100644 --- a/cogs/music/join.py +++ b/cogs/music/join.py @@ -6,6 +6,7 @@ import logging from discord.ext import commands +from cogs.voice import get_voice_manager logger = logging.getLogger(__name__) @@ -16,8 +17,9 @@ class Join(commands.Cog): @commands.slash_command(name="join", description="dołącza do kanalu") async def join(self, ctx): + voice_mgr = get_voice_manager(self.bot) channel = ctx.author.voice.channel - await channel.connect() + await voice_mgr.connect(channel) await ctx.respond(content="\u200b", ephemeral=True) await ctx.interaction.delete_original_response() logger.info("Bot connected to voice channel") diff --git a/cogs/music/stop.py b/cogs/music/stop.py index f06e7f5..9c8d5cf 100644 --- a/cogs/music/stop.py +++ b/cogs/music/stop.py @@ -5,6 +5,8 @@ from discord.ext import commands +from cogs.voice import get_voice_manager + import logging logger = logging.getLogger(__name__) @@ -18,7 +20,8 @@ class Stop(commands.Cog): async def stop(self, ctx): await ctx.respond(content="\u200b", ephemeral=True) await ctx.interaction.delete_original_response() - await ctx.voice_client.disconnect() + voice_mgr = get_voice_manager(self.bot) + await voice_mgr.disconnect(ctx.guild) logger.info("Bot disconnected from voice channel") -- cgit v1.2.3