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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user