backend + telegram: добавлено поле chat_id у пользователя

This commit is contained in:
2022-11-20 02:22:35 +03:00
parent b5bd2b908f
commit ce934affe3
6 changed files with 43 additions and 202 deletions

View File

@@ -2,16 +2,34 @@ import json
from fastapi import FastAPI
import asyncio
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from textsouls.handlers import control
from textsouls.handlers import character_creation
with open("textsouls/config.json") as config_file:
config_data = json.load(config_file)
app = FastAPI()
bot = Bot(token=config_data["MAIN_SETTINGS"]["BOT_TOKEN"])
dp = Dispatcher(storage=MemoryStorage())
async def start_bot():
bot = Bot(token=config_data["MAIN_SETTINGS"]["BOT_TOKEN"])
dp = Dispatcher(storage=MemoryStorage())
dp.include_router(control.router)
dp.include_router(character_creation.router)
await bot.delete_webhook(drop_pending_updates=True)
await dp.start_polling(bot)
@app.on_event("startup")
async def startup_event():
asyncio.create_task(start_bot())
@app.get("/")