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,21 +2,44 @@ aiofiles==22.1.0
aiogram==3.0.0b6
aiohttp==3.8.3
aiosignal==1.3.1
anyio==3.6.2
async-timeout==4.0.2
attrs==22.1.0
Babel==2.9.1
cachetools==4.2.4
certifi==2022.9.24
charset-normalizer==2.1.1
click==8.1.3
dnspython==2.2.1
email-validator==1.3.0
fastapi==0.87.0
frozenlist==1.3.3
h11==0.14.0
httpcore==0.16.1
httptools==0.5.0
httpx==0.23.1
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
magic-filter==1.0.9
MarkupSafe==2.1.1
multidict==6.0.2
orjson==3.8.1
pydantic==1.10.2
python-dotenv==0.21.0
python-multipart==0.0.5
pytz==2022.6
PyYAML==6.0
requests==2.28.1
rfc3986==1.5.0
six==1.16.0
sniffio==1.3.0
starlette==0.21.0
typing-extensions==4.4.0
ujson==5.5.0
urllib3==1.26.12
uvicorn==0.19.0
uvloop==0.17.0
watchfiles==0.18.1
websockets==10.4
yarl==1.8.1

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)
if __name__ == "__main__":
asyncio.run(main())
@app.get("/")
async def root():
return {"message": "Hello World"}