mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 22:12:15 +00:00
telegram
This commit is contained in:
14
scripts/loadbalancer/loadbalancer_lib/telegram_.py
Normal file
14
scripts/loadbalancer/loadbalancer_lib/telegram_.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import requests
|
||||
|
||||
|
||||
def telegram_send_message(message, bot_token, chat_id):
|
||||
url = f'https://api.telegram.org/bot{bot_token}/sendMessage'
|
||||
|
||||
payload = {'chat_id': chat_id, 'text': message}
|
||||
|
||||
response = requests.post(url, data=payload)
|
||||
|
||||
if response.status_code == 200:
|
||||
print('Message sent successfully!')
|
||||
else:
|
||||
print('Failed to send message:', response.text)
|
||||
Reference in New Issue
Block a user