31 lines
758 B
Python
31 lines
758 B
Python
"""
|
|
Routines command handler - bot-side hooks for routine management
|
|
"""
|
|
|
|
from bot.command_registry import register_module
|
|
import ai.parser as ai_parser
|
|
|
|
|
|
async def handle_routine(message, session, parsed):
|
|
action = parsed.get("action", "unknown")
|
|
token = session["token"]
|
|
user_uuid = session["user_uuid"]
|
|
|
|
# TODO: wire up API calls per action
|
|
pass
|
|
|
|
|
|
def validate_routine_json(data):
|
|
errors = []
|
|
if not isinstance(data, dict):
|
|
return ["Response must be a JSON object"]
|
|
if "error" in data:
|
|
return []
|
|
if "action" not in data:
|
|
errors.append("Missing required field: action")
|
|
return errors
|
|
|
|
|
|
register_module("routine", handle_routine)
|
|
ai_parser.register_validator("routine", validate_routine_json)
|