Untested Phase 1 (Foundation & Resource management) of voice chat integration
This commit is contained in:
@@ -17,12 +17,34 @@ logger = get_logger('autonomous')
|
||||
_last_action_execution = {} # guild_id -> timestamp
|
||||
_MIN_ACTION_INTERVAL = 30 # Minimum 30 seconds between autonomous actions
|
||||
|
||||
# Pause state for voice sessions
|
||||
_autonomous_paused = False
|
||||
|
||||
|
||||
def pause_autonomous_system():
|
||||
"""Pause autonomous message generation (called during voice sessions)"""
|
||||
global _autonomous_paused
|
||||
_autonomous_paused = True
|
||||
logger.info("Autonomous system paused")
|
||||
|
||||
|
||||
def resume_autonomous_system():
|
||||
"""Resume autonomous message generation (called after voice sessions)"""
|
||||
global _autonomous_paused
|
||||
_autonomous_paused = False
|
||||
logger.info("Autonomous system resumed")
|
||||
|
||||
|
||||
async def autonomous_tick_v2(guild_id: int):
|
||||
"""
|
||||
New autonomous tick that uses context-aware decision making.
|
||||
Replaces the random 10% chance with intelligent decision.
|
||||
"""
|
||||
# Check if autonomous is paused (voice session)
|
||||
if _autonomous_paused:
|
||||
logger.debug(f"[V2] Autonomous system paused (voice session active)")
|
||||
return
|
||||
|
||||
# Rate limiting check
|
||||
now = time.time()
|
||||
if guild_id in _last_action_execution:
|
||||
|
||||
Reference in New Issue
Block a user