feat: добавлена переменная TELEGRAM_API_URL для прокси
This commit is contained in:
+2
-1
@@ -24,6 +24,7 @@ MIKROTIK_PASSWORD = os.environ["MIKROTIK_PASSWORD"]
|
|||||||
|
|
||||||
TELEGRAM_BOT_TOKEN = os.environ["TELEGRAM_BOT_TOKEN"]
|
TELEGRAM_BOT_TOKEN = os.environ["TELEGRAM_BOT_TOKEN"]
|
||||||
TELEGRAM_CHAT_ID = os.environ["TELEGRAM_CHAT_ID"]
|
TELEGRAM_CHAT_ID = os.environ["TELEGRAM_CHAT_ID"]
|
||||||
|
TELEGRAM_API_URL = os.getenv("TELEGRAM_API_URL", "https://api.telegram.org")
|
||||||
|
|
||||||
# Имя address-list в MikroTik (/ip firewall address-list)
|
# Имя address-list в MikroTik (/ip firewall address-list)
|
||||||
ADDRESS_LIST_NAME = os.environ["ADDRESS_LIST_NAME"]
|
ADDRESS_LIST_NAME = os.environ["ADDRESS_LIST_NAME"]
|
||||||
@@ -48,7 +49,7 @@ log = logging.getLogger(__name__)
|
|||||||
# Telegram
|
# Telegram
|
||||||
# ──────────────────────────────────────────────
|
# ──────────────────────────────────────────────
|
||||||
async def send_telegram(message: str) -> None:
|
async def send_telegram(message: str) -> None:
|
||||||
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
url = f"{TELEGRAM_API_URL}/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
||||||
payload = {"chat_id": TELEGRAM_CHAT_ID, "text": message, "parse_mode": "HTML"}
|
payload = {"chat_id": TELEGRAM_CHAT_ID, "text": message, "parse_mode": "HTML"}
|
||||||
async with httpx.AsyncClient(timeout=10) as client:
|
async with httpx.AsyncClient(timeout=10) as client:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ services:
|
|||||||
# Telegram
|
# Telegram
|
||||||
- TELEGRAM_BOT_TOKEN=123456:AABBcc # ← токен от @BotFather
|
- TELEGRAM_BOT_TOKEN=123456:AABBcc # ← токен от @BotFather
|
||||||
- TELEGRAM_CHAT_ID=-1001234567890 # ← ID чата/группы
|
- TELEGRAM_CHAT_ID=-1001234567890 # ← ID чата/группы
|
||||||
|
# URL API (замените на прокси если api.telegram.org заблокирован)
|
||||||
|
- TELEGRAM_API_URL=https://api.telegram.org
|
||||||
|
|
||||||
# Имя address-list из /ip firewall address-list на MikroTik
|
# Имя address-list из /ip firewall address-list на MikroTik
|
||||||
- ADDRESS_LIST_NAME=monitor
|
- ADDRESS_LIST_NAME=monitor
|
||||||
|
|||||||
Reference in New Issue
Block a user