Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,16 +18,14 @@ def send_telegram_message(arg1:str)-> str: #it's import to specify the return ty
|
|
| 18 |
"""A tool that send message to telegram chat
|
| 19 |
Args:
|
| 20 |
arg1: the message which will send to telegram chat
|
| 21 |
-
arg2: the second argument
|
| 22 |
"""
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
url=f"https://api.telegram.org/bot{TOKEN}/sendMessage",
|
| 27 |
-
data=data)
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
@tool
|
|
|
|
| 18 |
"""A tool that send message to telegram chat
|
| 19 |
Args:
|
| 20 |
arg1: the message which will send to telegram chat
|
|
|
|
| 21 |
"""
|
| 22 |
|
| 23 |
+
url = f"https://api.telegram.org/bot{TOKEN}/sendMessage"
|
| 24 |
+
payload = {"chat_id": CHAT_ID, "text": arg1}
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
resp = requests.post(url, data=payload, timeout=10)
|
| 27 |
+
resp.raise_for_status() # ↳ кинет исключение, если Telegram вернул ошибку
|
| 28 |
+
return (resp.json())
|
| 29 |
|
| 30 |
|
| 31 |
@tool
|