dashboard: userlarga message yozish uchun api qoshildi

This commit is contained in:
behruz
2025-12-10 16:39:28 +05:00
parent 479d8b8faa
commit b924442631
4 changed files with 68 additions and 1 deletions

View File

@@ -30,4 +30,21 @@ def send_to_telegram(chat_id, order_id):
except Exception as e:
print(f"Telegram xatolik: {e}")
return False
def send_message(chat_id, message):
bot_token = settings.BOT_TOKEN
try:
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
data = {
"chat_id": chat_id,
"text": message
}
response = requests.post(url, data=data)
print(response.json())
return True
except Exception as e:
print(f"Telegram xatosi: {e}")
return False