mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
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>
This commit is contained in:
parent
b08ba78898
commit
e3dc7d576b
13 changed files with 54 additions and 30 deletions
|
|
@ -16,6 +16,8 @@ from aiogram.types import (
|
|||
ReplyKeyboardRemove,
|
||||
)
|
||||
|
||||
TOKEN = getenv("BOT_TOKEN")
|
||||
|
||||
BUTTON_CANCEL = KeyboardButton(text="❌ Cancel")
|
||||
BUTTON_BACK = KeyboardButton(text="🔙 Back")
|
||||
|
||||
|
|
@ -195,9 +197,13 @@ def create_dispatcher() -> Dispatcher:
|
|||
return dispatcher
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dp = create_dispatcher()
|
||||
bot = Bot(token=TOKEN)
|
||||
dp.run_polling(bot)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Recommended to use CLI instead of this snippet.
|
||||
# `aiogram run polling scene_example:create_dispatcher --token BOT_TOKEN --log-level info`
|
||||
dp = create_dispatcher()
|
||||
bot = Bot(token=getenv("TELEGRAM_TOKEN"))
|
||||
dp.run_polling()
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue