Command Dispatcher

This module provides a lightweight yet powerful dispatcher for “exclamation commands” that are commonly used in chat-based user interfaces. It converts messages such as !help or !deposit 100 into asynchronous function calls and returns a reply via direct message on Nostr.

class agentstr.commands.Commands(nostr_client: NostrClient, commands: dict[str, Callable[[str, str], None]])[source]

Bases: object

__init__(nostr_client: NostrClient, commands: dict[str, Callable[[str, str], None]])[source]
async default(command: str, pubkey: str)[source]
async run_command(command: str, pubkey: str)[source]
class agentstr.commands.DefaultCommands(db: Database, nostr_client: NostrClient, agent_info: AgentCard)[source]

Bases: Commands

__init__(db: Database, nostr_client: NostrClient, agent_info: AgentCard)[source]