Untested Phase 1 (Foundation & Resource management) of voice chat integration
This commit is contained in:
28
bot/bot.py
28
bot/bot.py
@@ -125,6 +125,19 @@ async def on_message(message):
|
||||
if message.author == globals.client.user:
|
||||
return
|
||||
|
||||
# Check for voice commands first (!miku join, !miku leave, !miku voice-status)
|
||||
if not isinstance(message.channel, discord.DMChannel) and message.content.strip().lower().startswith('!miku '):
|
||||
from commands.voice import handle_voice_command
|
||||
|
||||
parts = message.content.strip().split()
|
||||
if len(parts) >= 2:
|
||||
cmd = parts[1].lower()
|
||||
args = parts[2:] if len(parts) > 2 else []
|
||||
|
||||
if cmd in ['join', 'leave', 'voice-status']:
|
||||
await handle_voice_command(message, cmd, args)
|
||||
return
|
||||
|
||||
# Skip processing if a bipolar argument is in progress in this channel
|
||||
if not isinstance(message.channel, discord.DMChannel):
|
||||
from utils.bipolar_mode import is_argument_in_progress
|
||||
@@ -196,6 +209,14 @@ async def on_message(message):
|
||||
logger.error(f"Failed to fetch replied message for context: {e}")
|
||||
|
||||
async with message.channel.typing():
|
||||
# Check if vision model is blocked (voice session active)
|
||||
if message.attachments and globals.VISION_MODEL_BLOCKED:
|
||||
await message.channel.send(
|
||||
"🎤 I can't look at images or videos right now, I'm talking in voice chat! "
|
||||
"Send it again after I leave the voice channel."
|
||||
)
|
||||
return
|
||||
|
||||
# If message has an image, video, or GIF attachment
|
||||
if message.attachments:
|
||||
for attachment in message.attachments:
|
||||
@@ -504,6 +525,13 @@ async def on_message(message):
|
||||
if is_image_request and image_prompt:
|
||||
logger.info(f"🎨 Image generation request detected: '{image_prompt}' from {message.author.display_name}")
|
||||
|
||||
# Block image generation during voice sessions
|
||||
if globals.IMAGE_GENERATION_BLOCKED:
|
||||
await message.channel.send(globals.IMAGE_GENERATION_BLOCK_MESSAGE)
|
||||
await message.add_reaction('🎤')
|
||||
logger.info("🚫 Image generation blocked - voice session active")
|
||||
return
|
||||
|
||||
# Handle the image generation workflow
|
||||
success = await handle_image_generation_request(message, image_prompt)
|
||||
if success:
|
||||
|
||||
Reference in New Issue
Block a user