telegram: добавлен FastAPI

This commit is contained in:
2022-11-19 19:41:08 +03:00
parent 193c4cd5db
commit e8de8f8027
4 changed files with 35 additions and 20 deletions

View File

@@ -2,8 +2,8 @@ from aiogram import Router
from aiogram.filters import Command
from aiogram.fsm.state import StatesGroup, State
from common import backend
from keyboards.common import row_kb
from textsouls.common import backend
from textsouls.keyboards.common import row_kb
router = Router()

View File

@@ -1,10 +1,10 @@
from aiogram import Router
from aiogram.filters import Command
from common import backend
from textsouls.common import backend
from handlers.character_creation import CharachterCreation
from handlers.character_creation import character_creation
from textsouls.handlers.character_creation import CharachterCreation
from textsouls.handlers.character_creation import character_creation
router = Router()

View File

@@ -1,27 +1,19 @@
import json
import asyncio
from fastapi import FastAPI
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.memory import MemoryStorage
from handlers import control
from handlers import character_creation
with open("textsouls/config.json") as config_file:
config_data = json.load(config_file)
app = FastAPI()
async def main():
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)
bot = Bot(token=config_data["MAIN_SETTINGS"]["BOT_TOKEN"])
dp = Dispatcher(storage=MemoryStorage())
if __name__ == "__main__":
asyncio.run(main())
@app.get("/")
async def root():
return {"message": "Hello World"}