2023-08-13 18:00:59 +03:00
|
|
|
from aiogram import Router
|
2024-05-31 11:11:21 -06:00
|
|
|
from aiogram.filters import CommandStart
|
2023-08-13 18:00:59 +03:00
|
|
|
from aiogram.types import Message
|
|
|
|
|
|
|
|
|
|
start_router = Router()
|
|
|
|
|
|
|
|
|
|
|
2024-05-31 11:11:21 -06:00
|
|
|
@start_router.message(CommandStart())
|
2023-08-13 18:00:59 +03:00
|
|
|
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>")
|