ShopBot/load.py

29 lines
590 B
Python
Raw Permalink Normal View History

2022-06-04 22:02:51 +03:00
import json
from aiogram import Dispatcher, Bot
from aiogram.bot.api import TelegramAPIServer
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from peewee import SqliteDatabase
from playhouse.db_url import connect
import config
2022-06-05 15:02:41 +03:00
from utils import messages # used, do not delete!
2022-06-04 22:02:51 +03:00
# Bot init
bot = Bot(
token=config.token,
server=TelegramAPIServer.from_base(config.telegram_api_server)
)
storage = MemoryStorage()
dp = Dispatcher(
bot=bot,
storage=storage
)
2022-06-05 15:02:41 +03:00
db: SqliteDatabase = connect(config.db_url)
2022-06-04 22:02:51 +03:00
permissions = json.load(open(config.permission_file))