Tested Phase 1, fixed text channel blocking while in voice and implemented joining and leaving VC from Phase 2
This commit is contained in:
@@ -94,9 +94,18 @@ class VoiceSessionManager:
|
||||
# 9. Pause figurine notifier
|
||||
await self._pause_figurine_notifier()
|
||||
|
||||
# 10. Create and connect voice session
|
||||
# 10. Create voice session
|
||||
self.active_session = VoiceSession(guild_id, voice_channel, text_channel)
|
||||
# Note: Actual voice connection will be implemented in Phase 2
|
||||
|
||||
# 11. Connect to Discord voice channel
|
||||
try:
|
||||
voice_client = await voice_channel.connect()
|
||||
self.active_session.voice_client = voice_client
|
||||
self.active_session.active = True
|
||||
logger.info(f"✓ Connected to voice channel: {voice_channel.name}")
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to connect to voice channel: {e}", exc_info=True)
|
||||
raise
|
||||
|
||||
logger.info(f"✓ Voice session started successfully")
|
||||
|
||||
@@ -118,8 +127,13 @@ class VoiceSessionManager:
|
||||
logger.info("Ending voice session...")
|
||||
|
||||
try:
|
||||
# 1. Disconnect from voice (Phase 2 implementation)
|
||||
# await self.active_session.disconnect()
|
||||
# 1. Disconnect from voice channel
|
||||
if self.active_session.voice_client:
|
||||
try:
|
||||
await self.active_session.voice_client.disconnect()
|
||||
logger.info("✓ Disconnected from voice channel")
|
||||
except Exception as e:
|
||||
logger.error(f"Error disconnecting from voice: {e}")
|
||||
|
||||
# 2. Resume text channel inference
|
||||
await self._resume_text_channels()
|
||||
@@ -324,6 +338,13 @@ class VoiceSessionManager:
|
||||
"""Cleanup resources if session start fails"""
|
||||
logger.warning("Cleaning up after failed session start...")
|
||||
try:
|
||||
# Disconnect from voice if connected
|
||||
if self.active_session and self.active_session.voice_client:
|
||||
try:
|
||||
await self.active_session.voice_client.disconnect()
|
||||
except:
|
||||
pass
|
||||
|
||||
await self._unblock_vision_model()
|
||||
await self._enable_image_generation()
|
||||
await self._resume_text_channels()
|
||||
@@ -332,6 +353,9 @@ class VoiceSessionManager:
|
||||
await self._resume_autonomous_engine()
|
||||
await self._resume_scheduled_events()
|
||||
await self._resume_figurine_notifier()
|
||||
|
||||
# Clear the session
|
||||
self.active_session = None
|
||||
except Exception as e:
|
||||
logger.error(f"Error during cleanup: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user