diff options
| author | salmonik <raisersoft@proton.me> | 2026-04-10 15:08:10 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-04-10 15:08:10 +0200 |
| commit | 0c54b30e2b680cb618c22aaf73fad868dfa2fab8 (patch) | |
| tree | 607f2ef05dcc44b8a301bd3ba221d2a5352081b8 /cogs/voice.py | |
| parent | fix voice for the 9th time today, still on the way (diff) | |
| parent | "fix" voice management (diff) | |
| download | senator-sperma-0c54b30e2b680cb618c22aaf73fad868dfa2fab8.tar.gz senator-sperma-0c54b30e2b680cb618c22aaf73fad868dfa2fab8.zip | |
Merge branch 'main' of https://codeberg.org/salmonik/senator-sperma
Diffstat (limited to 'cogs/voice.py')
| -rw-r--r-- | cogs/voice.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cogs/voice.py b/cogs/voice.py index 8ee3699..316de7b 100644 --- a/cogs/voice.py +++ b/cogs/voice.py | |||
| @@ -69,6 +69,21 @@ class VoiceManager: | |||
| 69 | """Get existing voice client for a guild.""" | 69 | """Get existing voice client for a guild.""" |
| 70 | return discord.utils.get(self.bot.voice_clients, guild=guild) | 70 | return discord.utils.get(self.bot.voice_clients, guild=guild) |
| 71 | 71 | ||
| 72 | async def get_voice_status(self, guild): | ||
| 73 | """Get voice client status including connection and playback state. | ||
| 74 | |||
| 75 | Returns: | ||
| 76 | tuple: (voice_client, is_connected, is_playing) or (None, False, False) if no client | ||
| 77 | """ | ||
| 78 | voice_client = await self.get_voice_client(guild) | ||
| 79 | if voice_client is None: | ||
| 80 | return None, False, False | ||
| 81 | |||
| 82 | is_connected = voice_client.is_connected() | ||
| 83 | is_playing = voice_client.is_playing() if is_connected else False | ||
| 84 | |||
| 85 | return voice_client, is_connected, is_playing | ||
| 86 | |||
| 72 | async def play_audio(self, channel, audio_source, volume=1.0): | 87 | async def play_audio(self, channel, audio_source, volume=1.0): |
| 73 | """Play audio in a voice channel.""" | 88 | """Play audio in a voice channel.""" |
| 74 | voice_client = await self.join_channel(channel) | 89 | voice_client = await self.join_channel(channel) |
