19 lines
412 B
Python
19 lines
412 B
Python
import requests
|
|
from dotenv import load_dotenv
|
|
import os
|
|
load_dotenv()
|
|
|
|
|
|
BOT_TOKEN = os.getenv('BOT_TOKEN') # токен бота
|
|
CHAT_ID = os.getenv('CHAT_ID') # id чата
|
|
|
|
def send_telegram(text):
|
|
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
|
|
|
|
response = requests.post(url, json={
|
|
"chat_id": CHAT_ID,
|
|
"text": text
|
|
})
|
|
|
|
return response.json()
|