Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
from fastapi import FastAPI, Request
|
3 |
from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
|
4 |
import requests
|
@@ -6,7 +6,7 @@ import requests
|
|
6 |
TOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"
|
7 |
BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
|
8 |
|
9 |
-
|
10 |
|
11 |
app = FastAPI()
|
12 |
app.add_middleware(
|
@@ -20,9 +20,10 @@ app.add_middleware(
|
|
20 |
#https://api.telegram.org/bot6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU/setWebhook?url=https://matteoscript-TelegramBotSimple.hf.space/
|
21 |
|
22 |
@app.post("/")
|
23 |
-
def webhook(data: dict):
|
24 |
print(data)
|
25 |
-
|
|
|
26 |
#requests.get("http://api.telegram.org/bot6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU/sendMessage?chat_id=1738997897&text=Come_Stai_Vez")
|
27 |
#chat_id = data['message']['chat']['id']
|
28 |
#text = data['message']['text']
|
|
|
1 |
+
import httpx
|
2 |
from fastapi import FastAPI, Request
|
3 |
from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
|
4 |
import requests
|
|
|
6 |
TOKEN = "6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU"
|
7 |
BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
|
8 |
|
9 |
+
client = httpx.AsyncClient()
|
10 |
|
11 |
app = FastAPI()
|
12 |
app.add_middleware(
|
|
|
20 |
#https://api.telegram.org/bot6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU/setWebhook?url=https://matteoscript-TelegramBotSimple.hf.space/
|
21 |
|
22 |
@app.post("/")
|
23 |
+
async def webhook(data: dict):
|
24 |
print(data)
|
25 |
+
await client.get("https://script.google.com/macros/s/AKfycbxa8wXSr1ynlEONQ99s3WF5a9OTHSYWH7NkKsYI9Z2SeWRoU5c0-WzjY5Gn2iDhSgj5/exec")
|
26 |
+
#requests.get("https://script.google.com/macros/s/AKfycbxa8wXSr1ynlEONQ99s3WF5a9OTHSYWH7NkKsYI9Z2SeWRoU5c0-WzjY5Gn2iDhSgj5/exec")
|
27 |
#requests.get("http://api.telegram.org/bot6770617809:AAEhytQUOl3uZOFINVE7-o0KkIoAz8perGU/sendMessage?chat_id=1738997897&text=Come_Stai_Vez")
|
28 |
#chat_id = data['message']['chat']['id']
|
29 |
#text = data['message']['text']
|