misc: code consistency and bot instance creation

This commit is contained in:
sdmway 2024-05-07 20:14:38 -06:00
parent a7d3e9a720
commit df1ab06762
11 changed files with 32 additions and 20 deletions

View file

@ -1,5 +1,5 @@
from aiogram import Bot, F, Router
from aiogram.filters import Command
from aiogram.filters import Command, CommandStart
from aiogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
@ -11,7 +11,7 @@ from aiogram.types import (
my_router = Router()
@my_router.message(Command("start"))
@my_router.message(CommandStart())
async def command_start(message: Message, bot: Bot, base_url: str):
await bot.set_chat_menu_button(
chat_id=message.chat.id,

View file

@ -8,6 +8,8 @@ from handlers import my_router
from routes import check_data_handler, demo_handler, send_message_handler
from aiogram import Bot, Dispatcher
from aiogram.client.default import DefaultBotProperties
from aiogram.enums.parse_mode import ParseMode
from aiogram.types import MenuButtonWebApp, WebAppInfo
from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application
@ -24,7 +26,7 @@ async def on_startup(bot: Bot, base_url: str):
def main():
bot = Bot(token=TOKEN, parse_mode="HTML")
bot = Bot(token=TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
dispatcher = Dispatcher()
dispatcher["base_url"] = APP_BASE_URL
dispatcher.startup.register(on_startup)