diff --git a/sample/notify.js b/sample/notify.js index 49ae9f24..16bb88ee 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -482,9 +482,13 @@ function tgBotNotify(text, desp) { timeout, }; if (TG_PROXY_HOST && TG_PROXY_PORT) { + let proxyHost = TG_PROXY_HOST; + if (TG_PROXY_AUTH && !TG_PROXY_HOST.includes('@')) { + proxyHost = `${TG_PROXY_AUTH}@${TG_PROXY_HOST}`; + } let agent; agent = new ProxyAgent({ - uri: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`, + uri: `http://${proxyHost}:${TG_PROXY_PORT}`, }); options.dispatcher = agent; }