mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
19 lines
782 B
Python
19 lines
782 B
Python
|
|
from aiogram import Router
|
||
|
|
from aiogram.filters import Command
|
||
|
|
from aiogram.types import Message
|
||
|
|
|
||
|
|
start_router = Router()
|
||
|
|
|
||
|
|
|
||
|
|
@start_router.message(Command("start"))
|
||
|
|
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>")
|