Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import asyncio
|
||||
import os
|
||||
import time
|
||||
from typing import Dict, Optional, List
|
||||
from typing import Dict, Optional, List, Any
|
||||
from .whisper_worker import WhisperWorker
|
||||
|
||||
logger = logging.getLogger('Superviseur')
|
||||
|
|
@ -80,8 +80,14 @@ class VoiceManager:
|
|||
|
||||
|
||||
async def evaluate_and_connect(self, guild):
|
||||
"""Analyze voice channels in guild and connect if strategically relevant."""
|
||||
if self.current_channel and self.current_channel.guild == guild:
|
||||
"""Analyze voice channels in guild and connect if strategically relevant.
|
||||
Only connects if the bot is not already connected to ANY voice channel."""
|
||||
# Prevent connecting to multiple guilds simultaneously
|
||||
if self.current_channel is not None:
|
||||
return
|
||||
|
||||
# Also check if any voice client is already active for this guild
|
||||
if guild.voice_client is not None:
|
||||
return
|
||||
|
||||
best_channel = None
|
||||
|
|
@ -100,6 +106,11 @@ class VoiceManager:
|
|||
|
||||
async def join_channel(self, channel: discord.VoiceChannel):
|
||||
"""Securely join a voice channel with permission checking."""
|
||||
# Prevent joining if already connected somewhere
|
||||
if self.current_channel is not None:
|
||||
logger.debug(f"◈ Already connected to '{self.current_channel.name}', ignoring join request for '{channel.name}'.")
|
||||
return
|
||||
|
||||
try:
|
||||
# Physical authorization check
|
||||
me = channel.guild.me
|
||||
|
|
@ -367,4 +378,4 @@ class VoiceManager:
|
|||
"VOICE TERMINATION",
|
||||
"Connexion vocale terminée. Libération des ressources audio.",
|
||||
discord.Color.dark_grey()
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue