fix never working file download

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-02-06 16:05:18 +01:00
parent 0702d58ab0
commit 5212df422e
2 changed files with 5 additions and 4 deletions

View File

@ -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//\//-}"

View File

@ -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