aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/voice.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-20 15:40:18 +0200
committersalmonik <raisersoft@proton.me>2026-05-20 15:40:18 +0200
commit4663f260b55de0975661fda1c00f60d2ca6e4506 (patch)
treeb649850859595542f8e7916a5513e0840e911318 /cogs/voice.py
parentFix TTS and AI voice playback bugs (diff)
downloadsenator-sperma-4663f260b55de0975661fda1c00f60d2ca6e4506.tar.gz
senator-sperma-4663f260b55de0975661fda1c00f60d2ca6e4506.zip
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
Diffstat (limited to '')
-rw-r--r--cogs/voice.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/cogs/voice.py b/cogs/voice.py
index ba1993e..86416ef 100644
--- a/cogs/voice.py
+++ b/cogs/voice.py
@@ -151,6 +151,17 @@ class VoiceManager:
151 """Backward-compatible alias for connect().""" 151 """Backward-compatible alias for connect()."""
152 return await self.connect(channel) 152 return await self.connect(channel)
153 153
154 async def join_by_channel_id(self, channel_id):
155 """Join a voice channel by channel ID."""
156 channel = self.bot.get_channel(channel_id)
157 if not channel:
158 logger.error(f"Channel {channel_id} not found")
159 return None
160 if not isinstance(channel, discord.VoiceChannel):
161 logger.error(f"Channel {channel_id} is not a voice channel")
162 return None
163 return await self.connect(channel)
164
154 async def get_client(self, guild): 165 async def get_client(self, guild):
155 """Get existing voice client for a guild.""" 166 """Get existing voice client for a guild."""
156 return discord.utils.get(self.bot.voice_clients, guild=guild) 167 return discord.utils.get(self.bot.voice_clients, guild=guild)