meshai/meshai/commands/status.py
Matt fd3f995ebb Initial commit: MeshAI - LLM-powered Meshtastic assistant
Features:
- Multi-backend LLM support (OpenAI, Anthropic, Google)
- Rolling summary memory for token optimization (~70-80% reduction)
- Per-user conversation history with SQLite persistence
- Bang commands (!help, !ping, !reset, !status, !weather)
- Meshtastic integration via serial or TCP
- Message chunking for mesh network constraints (150 char limit)
- Rate limiting to prevent network congestion
- Rich TUI configurator
- Docker support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 11:53:46 -07:00

43 lines
1.1 KiB
Python

"""Status command handler."""
import time
from datetime import timedelta
from .. import __version__
from .base import CommandContext, CommandHandler
# Track bot start time
_start_time: float = time.time()
def set_start_time(t: float) -> None:
"""Set bot start time (called from main)."""
global _start_time
_start_time = t
class StatusCommand(CommandHandler):
"""Show bot status information."""
name = "status"
description = "Show bot status"
usage = "!status"
async def execute(self, args: str, context: CommandContext) -> str:
"""Return bot status information."""
# Calculate uptime
uptime_seconds = int(time.time() - _start_time)
uptime = str(timedelta(seconds=uptime_seconds))
# Get history stats
stats = await context.history.get_stats()
# Build status message
parts = [
f"MeshAI v{__version__}",
f"Up: {uptime}",
f"Users: {stats['unique_users']}",
f"Msgs: {stats['total_messages']}",
]
return " | ".join(parts)