feat(global): init structure
This commit is contained in:
14
src/bot/handlers/__init__.py
Normal file
14
src/bot/handlers/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from aiogram import Router
|
||||
|
||||
from . import (
|
||||
initialize,
|
||||
start,
|
||||
)
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
router.include_routers(
|
||||
start.router,
|
||||
initialize.router,
|
||||
)
|
||||
3
src/bot/handlers/initialize/__init__.py
Normal file
3
src/bot/handlers/initialize/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .initializer import router
|
||||
|
||||
__all__ = ["router"]
|
||||
17
src/bot/handlers/initialize/initializer.py
Normal file
17
src/bot/handlers/initialize/initializer.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from aiogram import Bot, Router, types
|
||||
from rich import print
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.startup()
|
||||
async def startup(bot: Bot):
|
||||
await bot.set_my_commands(
|
||||
[types.BotCommand(command="/start", description="Запустить бота")]
|
||||
)
|
||||
print(f"[green]Started as[/] @{(await bot.me()).username}")
|
||||
|
||||
|
||||
@router.shutdown()
|
||||
async def shutdown():
|
||||
print("Shutting down bot...")
|
||||
3
src/bot/handlers/start/__init__.py
Normal file
3
src/bot/handlers/start/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .start import router
|
||||
|
||||
__all__ = ["router"]
|
||||
9
src/bot/handlers/start/start.py
Normal file
9
src/bot/handlers/start/start.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from aiogram import Router, types
|
||||
from aiogram.filters import CommandStart
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(CommandStart())
|
||||
async def on_start(message: types.Message):
|
||||
await message.reply("hewo everynyan")
|
||||
Reference in New Issue
Block a user