mirror of
https://github.com/Redume/Shirino.git
synced 2025-05-19 02:05:26 +01:00
chore: added new updates and moved the database instance to another file
This commit is contained in:
parent
b5d8edcc38
commit
b671981bb3
2 changed files with 5 additions and 4 deletions
3
bot.py
3
bot.py
|
@ -3,6 +3,9 @@ from aiogram.client.default import DefaultBotProperties
|
|||
from aiogram.enums import ParseMode
|
||||
import yaml
|
||||
|
||||
from database.server import Database
|
||||
|
||||
db = Database('/data/shirino.db')
|
||||
config = yaml.safe_load(open('../config.yaml', 'r', encoding='utf-8'))
|
||||
bot = Bot(
|
||||
token=config['telegram_token'],
|
||||
|
|
6
main.py
6
main.py
|
@ -6,11 +6,9 @@ from aiogram import Dispatcher
|
|||
from aiogram.webhook.aiohttp_server import SimpleRequestHandler, setup_application
|
||||
|
||||
from commands import currency, start, settings
|
||||
from database.server import Database
|
||||
from bot import bot
|
||||
from bot import bot, db
|
||||
|
||||
config = yaml.safe_load(open('../config.yaml', 'r', encoding='utf-8'))
|
||||
db = Database('shirino.db')
|
||||
|
||||
async def on_startup(bot: bot) -> None:
|
||||
await db.connect()
|
||||
|
@ -18,7 +16,7 @@ async def on_startup(bot: bot) -> None:
|
|||
await bot.set_webhook(
|
||||
f"{config['webhook']['base_url']}{config['webhook']['path']}",
|
||||
secret_token=config['webhook']['secret_token'],
|
||||
allowed_updates=['inline_query', 'message']
|
||||
allowed_updates=['inline_query', 'message', 'callback_query']
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue