# `ExGram.BotInit.SetupCommands`
[🔗](https://github.com/rockneurotiko/ex_gram/blob/0.64.0/lib/ex_gram/bot_init/setup_commands.ex#L1)

A `ExGram.BotInit` hook that registers the bot's commands with Telegram at
startup.

This hook is automatically injected by the dispatcher when
`setup_commands: true` is given to `use ExGram.Bot` or when starting the
bot:

    {MyBot, [method: :polling, token: token, setup_commands: true]}

It delegates to `ExGram.Bot.SetupCommands.setup/2`, which calls
`setMyCommands` for each declared command scope/language combination.

The hook expects a `bot_module` key in the hook opts, which the dispatcher
injects automatically. It reads `bot_module.commands()` to get the full
command definitions.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
