Helpers for working with Telegram file downloads.
After retrieving file metadata with ExGram.get_file/2, use file_url/2 to
generate the download URL for the file.
Summary
Functions
Generate the full file URL ready to be downloaded.
Types
@type file() :: String.t() | {:file, String.t()} | {:file_content, iodata() | File.Stream.t(), String.t()}
Functions
@spec file_url( ExGram.Model.File.t(), keyword() ) :: String.t()
Generate the full file URL ready to be downloaded.
Usage
First, retrieve the file metadata:
{:ok, file} = ExGram.get_file(file_id)Then generate the download URL:
ExGram.File.file_url(file)You can pass the usual :bot and :token params:
ExGram.File.file_url(file, bot: :my_bot)
ExGram.File.file_url(file, token: "MyBotToken")