mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
misc: code consistency and bot instance creation
This commit is contained in:
parent
a7d3e9a720
commit
df1ab06762
11 changed files with 32 additions and 20 deletions
|
|
@ -6,6 +6,7 @@ from handlers.echo import echo_router
|
|||
from handlers.start import start_router
|
||||
|
||||
from aiogram import Bot, Dispatcher
|
||||
from aiogram.client.default import DefaultBotProperties
|
||||
from aiogram.enums import ParseMode
|
||||
|
||||
# Bot token can be obtained via https://t.me/BotFather
|
||||
|
|
@ -22,7 +23,7 @@ async def main() -> None:
|
|||
)
|
||||
|
||||
# Initialize Bot instance with a default parse mode which will be passed to all API calls
|
||||
bot = Bot(TOKEN, parse_mode=ParseMode.HTML)
|
||||
bot = Bot(token=TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
|
||||
# And the run events dispatching
|
||||
await dp.start_polling(bot)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
from aiogram import Router
|
||||
from aiogram.filters import Command
|
||||
from aiogram.filters import CommandStart
|
||||
from aiogram.types import Message
|
||||
|
||||
start_router = Router()
|
||||
|
||||
|
||||
@start_router.message(Command("start"))
|
||||
@start_router.message(CommandStart())
|
||||
async def command_start_handler(message: Message) -> None:
|
||||
"""
|
||||
This handler receives messages with `/start` command
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue