getFileПоддерживается
Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.staticgram.top/file/bot<token>/<file_path>, where <file_path> is taken from the response. 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.
Параметры
File identifier to get information about
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
Пример запроса
curl
curl "https://api.staticgram.top/bot$TOKEN/getFile" \
-H "Content-Type: application/json" \
-d '{
"file_id": "AgACAgIAAxkBAA..."
}'aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)
result = await bot.get_file(file_id="AgACAgIAAxkBAA...")JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/getFile`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"file_id": "AgACAgIAAxkBAA..."
}),
});
const data = await res.json();Ответ (File)
JSON
{
"ok": true,
"result": {
"file_id": "...",
"file_unique_id": "..."
}
}