# Initial structure and a simple handler

**Check out the** [**pyrogram documentation**](https://docs.pyrogram.org/) **first, this only describes the specifics of writing for PBModular!**

Following the example from the previous section, create the module directory. Now we need to write a command, let it be `/hello`. Let the bot respond "Hello World" to this command.

```
async def on_hello(self, bot: Client, message: Message):
    await message.reply("Hello World!")
```

Fine. However, the bot doesn't know that this command is declared, the function needs to be registered as a command handler. This is done by using one of 3 decorators that let the module class know that this method is a command handler: `@command`, `@callback_query`, `@message`.

The `@command` decorator takes as arguments a list or a single command to which the bot will respond, and an optional [Pyrogram filter.](https://docs.pyrogram.org/topics/use-filters) The `@callback_query` is for handling button events, `@message` is for handling any messages. The Pyrogram filter is accepted in the arguments, even though it is optional, it is highly recommended to install it!

So, we import the `@command` decorator from `base.module`, and use it!

```
from base.module import command
...
@command("hello")
async def on_hello(self, bot: Client, message: Message):
    await message.reply("Hello World!")

# Пример использования с фильтром
from pyrogram import filters
...
@command("start", filters.regex(r"/start \w+$"))
```

{% hint style="info" %}
Initially there was registration of commands based on function name, as implemented in the FTG userbot and its forks. However, in the course of development it was recognized as an inconvenient and non-obvious way of registration
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pbmodular-docs.gitbook.io/eng-docs/module-development/initial-structure-and-a-simple-handler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
