> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# On Command • AI Agent SDK

> on_command: Decorator to register a command handler.

# on\_command

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**BotProtocol**](../classes/BotProtocol) class in the [**protocols**](../modules/protocols) module.

Decorator to register a command handler.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def on_command(command: str) -> Callable
```

## Parameters

<ParamField query="command" type="str" required={true}>
  Command name (without /)
</ParamField>

### Returns

<ResponseField name="Returns" type="Callable">
  The result of the operation.
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
@bot.on_command("help")
    async def handle_help(message: BotMessage):
        await bot.send_message(message.channel.channel_id, "Help text...")
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/bots/protocols.py#L410">
  `praisonaiagents/bots/protocols.py` at line 410
</Card>
