Update main.py
This commit is contained in:
@@ -174,16 +174,24 @@ async def send_telegram_alert(message: str):
|
|||||||
"""Send alert to telegram bot"""
|
"""Send alert to telegram bot"""
|
||||||
import aiohttp
|
import aiohttp
|
||||||
try:
|
try:
|
||||||
|
print(f"📱 Sending alert to Telegram: {TELEGRAM_API_URL}")
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.post(
|
async with session.post(
|
||||||
TELEGRAM_API_URL,
|
TELEGRAM_API_URL,
|
||||||
json={"message": message},
|
json={"message": message},
|
||||||
headers={"Authorization": f"Bearer {SECRET_TOKEN}"}
|
headers={"Authorization": f"Bearer {SECRET_TOKEN}"}
|
||||||
) as resp:
|
) as resp:
|
||||||
|
response_text = await resp.text()
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
print(f"Failed to send telegram alert: {await resp.text()}")
|
print(f"❌ Failed to send telegram alert: Status {resp.status}")
|
||||||
|
print(f" Response: {response_text}")
|
||||||
|
else:
|
||||||
|
print(f"✅ Telegram alert sent successfully")
|
||||||
|
print(f" Response: {response_text}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error sending telegram alert: {e}")
|
print(f"❌ Error sending telegram alert: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
async def fetch_task_names():
|
async def fetch_task_names():
|
||||||
"""Fetch task names from scoreboard API"""
|
"""Fetch task names from scoreboard API"""
|
||||||
|
|||||||
Reference in New Issue
Block a user