Skip to content

API Reference parrot.integrations.telegram.decorators

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.integrations.telegram.decorators

View source

Decorator for declaring agent methods as Telegram bot commands.

Function discover_telegram_commands

Scan an agent instance for methods decorated with @telegram_command.

Returns a list of dicts, each containing: - command: str (e.g. "question") - description: str - parse_mode: str - method_name: str (the actual method name on the agent) - method: bound method reference

discover_telegram_commands(agent: Any) -> List[Dict[str, Any]]

Parameter Type Default Description
agent Any

Returns: List[Dict[str, Any]]

Function telegram_command

Mark an agent method as a Telegram slash command.

The decorator stores metadata on the function via _telegram_command. Registration with aiogram happens at bot startup (not at decoration time).

telegram_command(command: str, description: str = '', parse_mode: str = 'keyword') -> Callable

Parameter Type Default Description
command str Command name without leading slash (e.g. "question").
description str '' One-line description shown in the Telegram menu.
parse_mode str 'keyword' How to parse user input after the command. - "keyword": /cmd key=val key2=val2 → method(**kwargs) - "positional": /cmd arg1 arg2 → method(*args) - "raw": /cmd <everything> → method(text)

Returns: Callable

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally