getFile {telegram.bot} | R Documentation |
Prepare a file for downloading
Description
Use this method to get basic info about a file and prepare it for
downloading. For the moment, bots can download files of up to 20MB in size.
It is guaranteed that the link will be valid for at least 1 hour. When the
link expires, a new one can be requested by calling getFile
again.
Usage
getFile(file_id, destfile = NULL, ...)
Arguments
file_id |
The file identifier. |
destfile |
(Optional). If you want to save the file, pass by a
character string with the name where the downloaded file is saved.
See the |
... |
(Optional). Additional parameters to be passed to
|
Details
You can also use it's snake_case equivalent get_file
.
Examples
## Not run:
bot <- Bot(token = bot_token("RTelegramBot"))
chat_id <- user_id("Me")
photos <- bot$getUserProfilePhotos(chat_id = chat_id)
# Download user profile photo
file_id <- photos$photos[[1L]][[1L]]$file_id
bot$getFile(file_id, destfile = "photo.jpg")
## End(Not run)
[Package telegram.bot version 3.0.0 Index]