mirror of
https://github.com/anten-ka/go_warp_pro.git
synced 2026-05-19 14:45:59 +00:00
Fix bot_auto_chatid: disable+stop daemon to prevent Restart=always from stealing updates
Made-with: Cursor
This commit is contained in:
4
warp.sh
4
warp.sh
@@ -1723,8 +1723,9 @@ bot_remove_admin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bot_auto_chatid() {
|
bot_auto_chatid() {
|
||||||
|
systemctl disable warp-bot 2>/dev/null
|
||||||
systemctl stop warp-bot 2>/dev/null
|
systemctl stop warp-bot 2>/dev/null
|
||||||
sleep 1
|
sleep 3
|
||||||
local flush_resp last_uid
|
local flush_resp last_uid
|
||||||
flush_resp=$(curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates?offset=-1&limit=1")
|
flush_resp=$(curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates?offset=-1&limit=1")
|
||||||
last_uid=$(echo "$flush_resp" | jq -r '.result[-1].update_id // empty' 2>/dev/null)
|
last_uid=$(echo "$flush_resp" | jq -r '.result[-1].update_id // empty' 2>/dev/null)
|
||||||
@@ -1734,6 +1735,7 @@ bot_auto_chatid() {
|
|||||||
echo -e "${YELLOW} Отправьте боту 3 любых сообщения в Telegram.${NC}"
|
echo -e "${YELLOW} Отправьте боту 3 любых сообщения в Telegram.${NC}"
|
||||||
echo -e "${YELLOW} Затем нажмите Enter.${NC}"
|
echo -e "${YELLOW} Затем нажмите Enter.${NC}"
|
||||||
read -p " > " _
|
read -p " > " _
|
||||||
|
sleep 1
|
||||||
local resp; resp=$(curl -s --max-time 10 "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates?limit=10")
|
local resp; resp=$(curl -s --max-time 10 "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates?limit=10")
|
||||||
local c; c=$(echo "$resp" | jq -r '[.result[].message.chat.id // empty] | map(select(. != "")) | unique | first // empty' 2>/dev/null)
|
local c; c=$(echo "$resp" | jq -r '[.result[].message.chat.id // empty] | map(select(. != "")) | unique | first // empty' 2>/dev/null)
|
||||||
if [ -n "$c" ] && [[ "$c" =~ ^[0-9-]+$ ]]; then
|
if [ -n "$c" ] && [[ "$c" =~ ^[0-9-]+$ ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user