fix: Clear webhook before polling getUpdates in Telegram setup

If a bot token previously had a webhook configured (e.g. from a prior
install), getUpdates returns nothing and chat ID detection fails.
Adding deleteWebhook call before polling fixes fresh installs that
reuse an existing bot token.
This commit is contained in:
SamNet-dev
2026-02-10 11:41:55 -06:00
parent 258ff99109
commit d8331203a9

View File

@@ -5642,6 +5642,8 @@ ${report}"
}
telegram_get_chat_id() {
# Clear any existing webhook so getUpdates works
curl -s --max-time 5 "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/deleteWebhook" &>/dev/null
local response
response=$(curl -s --max-time 10 --max-filesize 1048576 "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates" 2>/dev/null)
[ -z "$response" ] && return 1