aiogram/examples/multi_file_bot/handlers/start.py
sdmway e3dc7d576b
misc: code consistency and bot instance creation (#1482)
* misc: code consistency and bot instance creation

* Changelog for aiogram#1482

* misc: consistency of comments and dispatcher instance creation

* misc: removed routers example

* Update CHANGES/1482.misc.rst

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2024-05-31 20:11:21 +03:00

18 lines
785 B
Python

from aiogram import Router
from aiogram.filters import CommandStart
from aiogram.types import Message
start_router = Router()
@start_router.message(CommandStart())
async def command_start_handler(message: Message) -> None:
"""
This handler receives messages with `/start` command
"""
# Most event objects have aliases for API methods that can be called in events' context
# For example if you want to answer to incoming message you can use `message.answer(...)` alias
# and the target chat will be passed to :ref:`aiogram.methods.send_message.SendMessage`
# method automatically or call API method directly via
# Bot instance: `bot.send_message(chat_id=message.chat.id, ...)`
await message.answer(f"Hello, <b>{message.from_user.full_name}!</b>")