Add Phase 2: integrations, admin, and remaining commands

New commands: agent, trivia (with 30s timer reveal), ask (Ollama LLM
with cooldown), minecraft (RCON whitelist), health (admin-only metrics).
Adds metrics tracking, per-user cooldowns, and admin permission checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 20:52:57 -05:00
parent 50de731a82
commit 5723ac3581
5 changed files with 325 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ from functools import wraps
from nio import AsyncClient, RoomMessageText
from config import BOT_PREFIX, MATRIX_USER_ID
from commands import COMMANDS
from commands import COMMANDS, metrics
logger = logging.getLogger("matrixbot")
@@ -16,6 +16,7 @@ def handle_command_errors(func):
return await func(client, room_id, sender, args)
except Exception as e:
logger.error(f"Error in command {func.__name__}: {e}", exc_info=True)
metrics.record_error(func.__name__)
try:
from utils import send_text
await send_text(client, room_id, "An unexpected error occurred. Please try again later.")
@@ -56,5 +57,6 @@ class Callbacks:
return
handler, _ = handler_entry
metrics.record_command(cmd_name)
wrapped = handle_command_errors(handler)
await wrapped(self.client, room.room_id, event.sender, args)