mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 04:26:23 +03:00
backend + telegram: добавлено поле chat_id у пользователя
This commit is contained in:
@@ -16,6 +16,7 @@ async def start(message, state):
|
||||
tg_user = message.from_user
|
||||
ts_user = {
|
||||
"id": tg_user.id,
|
||||
"chat_id": message.chat.id,
|
||||
"first_name": tg_user.first_name,
|
||||
"last_name": tg_user.last_name,
|
||||
"username": tg_user.username,
|
||||
|
||||
@@ -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("/")
|
||||
|
||||
Reference in New Issue
Block a user