Spaces:
Sleeping
Sleeping
Update main.py
Browse files4 unmodified lines5678910115 unmodified lines171819202122232425262728293031324 unmodified linesTOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"BASE_URL = f"https://api.telegram.org/bot{TOKEN}"#client = httpx.AsyncClient()app = FastAPI()app.add_middleware(5 unmodified lines)@app.post("/")def webhook(req: Request):print('a')print(req)return {"response": "TEST"}'''data = await req()print(data)chat_id = data['message']['chat']['id']text = data['message']['text']await client.get(f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}")return data'''@app.get("/")def read_general():4 unmodified lines5678910115 unmodified lines17181920212223242526272829304 unmodified linesTOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"BASE_URL = f"https://api.telegram.org/bot{TOKEN}"client = httpx.AsyncClient()app = FastAPI()app.add_middleware(5 unmodified lines)@app.post("/")async def webhook(req: Request):print('a')data = await req()print(data)chat_id = data['message']['chat']['id']text = data['message']['text']await client.get(f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}")return data@app.get("/")def read_general():
main.py+4-6