Closed zickkeen closed 3 years ago
The files are downloaded to bot's folder inside server's working directory. You need to set up your HTTPS server serve static files from subfolders of these folders. "/file/bot<token>/path/file_id.ext" should be translated to a path "<server's working directory>/<token>/path/file_id.ext".
That means we have to set up an http/https server to serve these folders/files?
Yes. You already have a HTTPS server to serve https://hostlocal.api. You need to set up it to serve files also.
can we run telegram-bot-api in https mode?
No. You must have an SSL-terminating web server,
I'm busy implementing this functionality to the @php-telegram-bot
@levlam So basically tdlib
does not offer any way to access the files via its internal HTTP server?
i.e. We need to set up a separate webserver that proxies the files?
@noplanman Yes. Bot API server downloads files and saves them locally. In --local
mode it returns full path to the file, otherwise it returns a relative path to the file, which can be then served using any HTTPS server.
@levlam Ok, thanks for the confirmation 👌
If you, like me, are not willing to create a server just to serve files, you can change the url to the default Telegram url (api.telegram.org), here it worked perfectly
@marcoslp010 You must not use api.telegram.org and a local server at the same time.
@marcoslp010 You must not use api.telegram.org and a local server at the same time.
use and only for downloading attachments
@marcoslp010 You must never use them both for any purpose. Even for downloading. Otherwise you will ran into too many issue with your bot.
Where are the files located? I'm using a generic url:
https://hostlocal.api/file/bot<token>/path/file_id.ext
andhttps://hostlocal.api/file/bot<token>/<file_path>?file_id=<file_id>
But the return always: