diff options
Diffstat (limited to 'shared/instances.py')
| -rw-r--r-- | shared/instances.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/shared/instances.py b/shared/instances.py index 9ca0b2c..fb511b3 100644 --- a/shared/instances.py +++ b/shared/instances.py | |||
| @@ -1,6 +1,19 @@ | |||
| 1 | from os.path import exists | ||
| 2 | |||
| 1 | from aiogram import Bot, Dispatcher | 3 | from aiogram import Bot, Dispatcher |
| 4 | from sqlalchemy import create_engine | ||
| 5 | from sqlalchemy.orm import Session, sessionmaker | ||
| 6 | |||
| 7 | from shared.settings import Chats, Settings | ||
| 2 | 8 | ||
| 3 | from shared.config import token | 9 | settings = Settings() |
| 10 | config = Chats() | ||
| 11 | if not exists("data/config.json"): | ||
| 12 | config.save("data/config.json") | ||
| 13 | config.load("data/config.json") | ||
| 4 | 14 | ||
| 5 | bot = Bot(token=token) | 15 | bot = Bot(token=settings.token) |
| 6 | dp = Dispatcher(bot) | 16 | dp = Dispatcher(bot) |
| 17 | |||
| 18 | engine = create_engine("sqlite:///data/database.sqlite") | ||
| 19 | session = sessionmaker(engine, Session) | ||
