enviar mensajes conseguido
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def send_message(bot_token: str, chat_id: str, mensaje: str) -> None:
|
||||
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
|
||||
payload = {"chat_id": chat_id, "text": f"{mensaje}"}
|
||||
|
||||
response = requests.post(url, json=payload, timeout=10)
|
||||
response.raise_for_status()
|
||||
print("Mensaje enviado:", response.json())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user