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,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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user