go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.76k stars 889 forks source link

How can I reupload a Documenet as a photo? #576

Open appleGun22 opened 2 years ago

appleGun22 commented 2 years ago

I've tried two methods, tgbotapi.FileID(file_id) (wrong file type) , tgbotapi.FileURL( bot.GetFileDirectURL(file_id) ) (wrong file identifier/HTTP URL specified)

but they do not work, can I reupload the file without downloading it?

temamagic commented 2 years ago

Any file_id has own type. If youre uploaded image as document, you need download it and upload as photo. You can't pass file_id of document type to sendPhoto method