Open Azat868 opened 1 year ago
Oh boy from the looks of it you need a lot of help. Have you committed your most recent changes to your fork? I can take a look later or tomorrow if so! I just submitted a PR to fix the topic group messages and stumbled upon this cry for help here lmao
The error is giving you exactly what you did wrong, check your brackets there, theyre heavily screwed up.
Clearly you didnt just copy paste, or it wouldn't be messed up like that,
here is what you have:
photo="${URLS[PHOTO]}")"
Here is the correct writing:
photo="${URLS[PHOTO]}"
notice on yours you have a rogue additional )"
Look closely at your bracket ratios, always, it is the most essential thing when it comes to scripting.
You need to get Visual Studio code and you need to open the telegram-bot-bash directory as a project folder in Visual Studio code.
Then you need to add the bash extension known as Shell Check and for better looking errors you should also install the extension Error Lens. The end result will help you SO much. You can also even get an SSH extension that allows you to edit files on an ubuntu server in real time, I will attatch a short gif of how obvious this would have been if you had my setup.
This is why you need VIsual Studio Code with Shell Check and Error Lens ASAP
This is my list of extensions, the only other ones I use are cosmetic (the blue theme is Winter Is Coming and looks sooo much better when not washed out by dumb HDR bug):
The SSH stuff is so you can go from vs code direct to server, it literally installs the modules on the server so that everything is real time, it's a game changer!
@harryeffinpotter thanks for helping, i'll have a look on your PR later on
@gnadelwartz @harryeffinpotter How to download high resolution image? Im tryied:
*)
photo="${URLS[PHOTO]}"
send_normal_message "${CHAT[ID]}" "$photo"
send_normal_message "${CHAT[ID]}" "test"
# first download
file=$(download_file ${photo})
;;
And send image to bot, image size 24kb:
But bot download 1kb preview image:
Pls tell me how to download full image...the usally its:
#Get file_id
curl https://api.telegram.org/bot$BOT_TOKEN/getFile?file_id=$file_id | jq .
# Ask by file_path to file_id
result=$(curl "https://api.telegram.org/bot$BOT_TOKEN/getFile?file_id=$file_id")
file_path=$(echo "$result" | jq -r .result.file_path)
#Download by file_path
curl -o "/root/photoshop/ClientImage.jpg" "https://api.telegram.org/file/bot$BOT_TOKEN/$file_path"
echo "Image saved at /root/photoshop/ClientImage.jpg"
But, how its work this bot and code?
And how to create next dialog with user:
Bot: Hi! Pls send me image
User: send photo
Bot: download image
Bot: Thx you, good bye
How to know, what message user send to bot?
Example:
User: send audio
Bot: Great music!
User: send pdf file
Bot: Good file!
Okay, im found... its not correct my friend because the first telegram sen low resolution file_id:
to fix this problem, im edit telegram-bot-bash\modules\processUpdates.sh :
URLS[PHOTO]="$(get_file "${UPD["result,${num},message,photo,0,file_id"]}")"
to:
URLS[PHOTO]="$(get_file "${UPD["result,${num},message,photo,2,file_id"]}")"
and now im get high resolution image
thanks for the hint, i'll add something similar in the next releases
Hi, pls help me User send to chat photo/images, how to download this photos? I read docs:
but this code has syntax error:
photo="${URLS[PHOTO]}")"
And im try to paste: