Initial commit: VoIdeaAI - voice-first AI idea assistant

This commit is contained in:
2026-05-13 12:51:42 +03:00
commit 688d043dad
421 changed files with 47915 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
"""Command decorator for auto-registration of bot commands.
Usage:
@bot_command(name="/idea", description="Create a new idea", requires_auth=True)
async def cmd_idea(update, context): ...
"""
from __future__ import annotations
import inspect
from dataclasses import dataclass, field
from typing import Any, Callable
@dataclass
class BotCommandDef:
name: str
description: str
requires_auth: bool = False
handler: Callable | None = None
_registry: list[BotCommandDef] = []
def bot_command(
name: str,
description: str,
requires_auth: bool = False,
) -> Callable:
"""Decorator that registers a function as a bot command handler."""
def wrapper(func: Callable) -> Callable:
_registry.append(BotCommandDef(
name=name,
description=description,
requires_auth=requires_auth,
handler=func,
))
return func
return wrapper
def get_registered_commands() -> list[BotCommandDef]:
"""Return all registered command definitions."""
return list(_registry)
def get_enabled_commands(enabled_names: set[str]) -> list[BotCommandDef]:
"""Return only commands that are in the enabled set."""
return [cmd for cmd in _registry if cmd.name in enabled_names]