From 5212df422e6de99e2e9861a6c0697d1aa271f7f6 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sat, 6 Feb 2021 16:05:18 +0100 Subject: [PATCH] fix never working file download --- bashbot.sh | 5 +++-- doc/6_reference.md | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 5870750..e28fd54 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb # 8 - curl/wget missing # 10 - not bash! # -#### $$VERSION$$ v1.41-dev-5-g54673ac +#### $$VERSION$$ v1.41-dev-6-g0702d58 ################################################################## # are we running in a terminal? @@ -346,6 +346,7 @@ fi BASHBOT_RETRY="" # retry by default URL="${BASHBOT_URL:-https://api.telegram.org/bot}${BOTTOKEN}" +FILEURL="${URL%%/bot*}/file/bot${BOTTOKEN}" ME_URL=${URL}'/getMe' ################# @@ -450,7 +451,7 @@ download_file() { fi else # prefix https://api.telegram... - url="${URL}/${url}" + url="${FILEURL}/${url}" fi # filename: replace "/" with "-", use mktemp if exist file="${DATADIR:-.}/${file//\//-}" diff --git a/doc/6_reference.md b/doc/6_reference.md index 5d900b4..5e80268 100644 --- a/doc/6_reference.md +++ b/doc/6_reference.md @@ -1444,8 +1444,8 @@ avatar.jpg jhsdf-avatar.jpg download-askjgftGJGdh1Z ####### # manually download files to current directory (not recommended) +getJson "${URL}/${photo}" >"downloaded_photo.jpg" getJson "https://avatars.githubusercontent.com/u/13046303" >"avatar.jpg" -getJson "i${URL}/${photo}" >"downloaded_photo.jpg" ls -F JSON.sh/ bin/ modules/ data-bot-bash/ @@ -1617,5 +1617,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca #### [Prev Best Practice](5_practice.md) #### [Next Notes for Developers](7_develop.md) -#### $$VERSION$$ v1.41-dev-5-g54673ac +#### $$VERSION$$ v1.41-dev-6-g0702d58