mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 04:26:23 +03:00
telegram: добавлен FastAPI
This commit is contained in:
@@ -2,21 +2,44 @@ aiofiles==22.1.0
|
|||||||
aiogram==3.0.0b6
|
aiogram==3.0.0b6
|
||||||
aiohttp==3.8.3
|
aiohttp==3.8.3
|
||||||
aiosignal==1.3.1
|
aiosignal==1.3.1
|
||||||
|
anyio==3.6.2
|
||||||
async-timeout==4.0.2
|
async-timeout==4.0.2
|
||||||
attrs==22.1.0
|
attrs==22.1.0
|
||||||
Babel==2.9.1
|
Babel==2.9.1
|
||||||
cachetools==4.2.4
|
cachetools==4.2.4
|
||||||
certifi==2022.9.24
|
certifi==2022.9.24
|
||||||
charset-normalizer==2.1.1
|
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
|
frozenlist==1.3.3
|
||||||
|
h11==0.14.0
|
||||||
|
httpcore==0.16.1
|
||||||
|
httptools==0.5.0
|
||||||
|
httpx==0.23.1
|
||||||
idna==3.4
|
idna==3.4
|
||||||
|
itsdangerous==2.1.2
|
||||||
Jinja2==3.1.2
|
Jinja2==3.1.2
|
||||||
magic-filter==1.0.9
|
magic-filter==1.0.9
|
||||||
MarkupSafe==2.1.1
|
MarkupSafe==2.1.1
|
||||||
multidict==6.0.2
|
multidict==6.0.2
|
||||||
|
orjson==3.8.1
|
||||||
pydantic==1.10.2
|
pydantic==1.10.2
|
||||||
|
python-dotenv==0.21.0
|
||||||
|
python-multipart==0.0.5
|
||||||
pytz==2022.6
|
pytz==2022.6
|
||||||
|
PyYAML==6.0
|
||||||
requests==2.28.1
|
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
|
typing-extensions==4.4.0
|
||||||
|
ujson==5.5.0
|
||||||
urllib3==1.26.12
|
urllib3==1.26.12
|
||||||
|
uvicorn==0.19.0
|
||||||
|
uvloop==0.17.0
|
||||||
|
watchfiles==0.18.1
|
||||||
|
websockets==10.4
|
||||||
yarl==1.8.1
|
yarl==1.8.1
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ from aiogram import Router
|
|||||||
from aiogram.filters import Command
|
from aiogram.filters import Command
|
||||||
from aiogram.fsm.state import StatesGroup, State
|
from aiogram.fsm.state import StatesGroup, State
|
||||||
|
|
||||||
from common import backend
|
from textsouls.common import backend
|
||||||
from keyboards.common import row_kb
|
from textsouls.keyboards.common import row_kb
|
||||||
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
from aiogram.filters import Command
|
from aiogram.filters import Command
|
||||||
|
|
||||||
from common import backend
|
from textsouls.common import backend
|
||||||
|
|
||||||
from handlers.character_creation import CharachterCreation
|
from textsouls.handlers.character_creation import CharachterCreation
|
||||||
from handlers.character_creation import character_creation
|
from textsouls.handlers.character_creation import character_creation
|
||||||
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import asyncio
|
from fastapi import FastAPI
|
||||||
|
|
||||||
from aiogram import Bot, Dispatcher
|
from aiogram import Bot, Dispatcher
|
||||||
from aiogram.fsm.storage.memory import MemoryStorage
|
from aiogram.fsm.storage.memory import MemoryStorage
|
||||||
|
|
||||||
from handlers import control
|
|
||||||
from handlers import character_creation
|
|
||||||
|
|
||||||
with open("textsouls/config.json") as config_file:
|
with open("textsouls/config.json") as config_file:
|
||||||
config_data = json.load(config_file)
|
config_data = json.load(config_file)
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
async def main():
|
|
||||||
bot = Bot(token=config_data["MAIN_SETTINGS"]["BOT_TOKEN"])
|
bot = Bot(token=config_data["MAIN_SETTINGS"]["BOT_TOKEN"])
|
||||||
dp = Dispatcher(storage=MemoryStorage())
|
dp = Dispatcher(storage=MemoryStorage())
|
||||||
|
|
||||||
dp.include_router(control.router)
|
|
||||||
dp.include_router(character_creation.router)
|
|
||||||
|
|
||||||
await bot.delete_webhook(drop_pending_updates=True)
|
@app.get("/")
|
||||||
await dp.start_polling(bot)
|
async def root():
|
||||||
|
return {"message": "Hello World"}
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(main())
|
|
||||||
|
|||||||
Reference in New Issue
Block a user