31 lines
782 B
Python
31 lines
782 B
Python
"""
|
|
Medications command handler - bot-side hooks for medication management
|
|
"""
|
|
|
|
from bot.command_registry import register_module
|
|
import ai.parser as ai_parser
|
|
|
|
|
|
async def handle_medication(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_medication_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("medication", handle_medication)
|
|
ai_parser.register_validator("medication", validate_medication_json)
|