@@ -28,12 +28,10 @@ def send_message(user_id, message_text, bot_url=None, api_token=None):
|
||||
webhook_port = os.getenv('WEBHOOK_PORT', '5005')
|
||||
|
||||
if webhook_url:
|
||||
# Извлекаем хост из WEBHOOK_URL
|
||||
from urllib.parse import urlparse
|
||||
parsed = urlparse(webhook_url)
|
||||
bot_url = f"http://{parsed.hostname}:{webhook_port}"
|
||||
# Используем внешний URL через reverse proxy
|
||||
bot_url = f"{webhook_url}/send_message"
|
||||
else:
|
||||
bot_url = f"http://localhost:{webhook_port}"
|
||||
bot_url = f"http://localhost:{webhook_port}/send_message"
|
||||
|
||||
if api_token is None:
|
||||
api_token = os.getenv('WEBHOOK_SECRET')
|
||||
|
||||
Reference in New Issue
Block a user