Telegram-Horoscope-Bot icon indicating copy to clipboard operation
Telegram-Horoscope-Bot copied to clipboard

Create tgbot

Open istirige opened this issue 6 months ago • 1 comments

import requests import time

🔧 Заміни на свій токен та канал

BOT_TOKEN = 'тут_твій_токен' CHANNEL_USERNAME = '@your_channel_name' # без пробілів

API_URL = 'https://api.alerts.in.ua/v1/alerts/active' REGION = 'kyivska'

already_alerting = False

def send_message(text): url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage" data = {'chat_id': CHANNEL_USERNAME, 'text': text} requests.post(url, data=data)

while True: try: response = requests.get(API_URL) data = response.json()

    region_alert = any(alert["region"] == REGION for alert in data)

    if region_alert and not already_alerting:
        send_message("🚨 Увага! Повітряна тривога в Київській області!")
        already_alerting = True

    elif not region_alert and already_alerting:
        send_message("✅ Відбій тривоги в Київській області.")
        already_alerting = False

except Exception as e:
    print("Помилка:", e)

time.sleep(60)  # перевірка раз на хвилину

istirige avatar Jun 06 '25 23:06 istirige

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - Telegram Bot Token 9b77053301046447e9e1a87175abe3acbeb5f4fe tgbot View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

gitguardian[bot] avatar Jun 06 '25 23:06 gitguardian[bot]