Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -171,7 +171,14 @@ class Superviseur(commands.Bot):
"""Internal telemetry log - bypassing AI to preserve resources."""
if not self.introspection_channel_id: return
channel = self.get_channel(self.introspection_channel_id) or await self.fetch_channel(self.introspection_channel_id)
channel = self.get_channel(self.introspection_channel_id)
if not channel:
try:
channel = await self.fetch_channel(self.introspection_channel_id)
except (discord.NotFound, discord.Forbidden, discord.HTTPException) as e:
logger.warning(f"Introspection channel {self.introspection_channel_id} not accessible: {e}")
return
if channel:
await self.messaging.send_embed(
channel,
@ -254,7 +261,9 @@ class Superviseur(commands.Bot):
if message.author == self.user:
return
logger.debug(f"Message received from {message.author} in {message.channel}")
channel_name = message.channel.name if hasattr(message.channel, 'name') else "DM"
guild_name = message.guild.name if message.guild else "DM"
logger.debug(f"Message received from {message.author} in #{channel_name} ({guild_name})")
# 1. Silent Moderation Scan (Background)
# On ne bloque pas le bot pour l'analyse, mais on la lance pour chaque message
@ -271,7 +280,10 @@ class Superviseur(commands.Bot):
if not self._should_respond(message):
return
logger.info(f"◈ SYSTEM: Interaction directe détectée pour '{message.author.display_name}'")
# Show server and channel context
guild_name = message.guild.name if message.guild else "DM"
channel_name = message.channel.name if hasattr(message.channel, 'name') else "DM"
logger.info(f"◈ SYSTEM: Interaction directe détectée pour '{message.author.display_name}' dans #{channel_name} ({guild_name})")
# Direct interaction (AI Response)
await self._handle_ai_interaction(message)
@ -342,18 +354,22 @@ class Superviseur(commands.Bot):
def _should_respond(self, message) -> bool:
"""Check if bot should respond to message."""
guild_name = message.guild.name if message.guild else "DM"
channel_name = message.channel.name if hasattr(message.channel, 'name') else "DM"
location = f"#{channel_name} ({guild_name})"
if message.content.startswith(self.command_prefix):
return True
if self.user in message.mentions:
logger.info("◈ DEBUG: Triggered by standard mentions list")
logger.info(f"◈ DEBUG: Triggered by mentions list in {location}")
return True
# Robust Mention Check (Regex Fallback)
bot_id = str(self.user.id)
logger.info(f"◈ DEBUG: Checking mention for ID {bot_id} in '{message.content[:30]}...'")
logger.info(f"◈ DEBUG: Checking mention for ID {bot_id} in '{message.content[:30]}...' ({location})")
if f"<@{bot_id}>" in message.content or f"<@!{bot_id}>" in message.content:
logger.info("◈ DEBUG: Triggered by string match (Regex Fallback)")
logger.info(f"◈ DEBUG: Triggered by string match in {location}")
return True