FilesPluginOptions
Options to pass to the files plugin. They are mainly useful if you are working with a local Bot API server, and you need to adjust from where to download files.
Properties
apiRoot
apiRoot?: string;Root URL of the Telegram Bot API server. Used when downloading files. Should be the same as for your bot object. Default: https://
environment
environment?: "prod" | "test";Specifies whether to use the test environment. Can be either "prod" (default) or "test".
The testing infrastructure is separate from the regular production infrastructure. No chats, accounts, or other data is shared between them. If you set this option to "test", you will need to make your Telegram client connect to the testing data centers of Telegram, register your phone number again, open a new chat with @BotFather, and create a separate bot.
buildFileUrl
buildFileUrl?: (
root: string,
token: string,
path: string,
env: "prod" | "test",
) => string | URL;URL builder function for downloading files. Can be used to modify which API server should be called when downloading files.
buildFilePath
buildFilePath?: (
root: string,
token: string,
path: string,
env: "prod" | "test",
) => string;Similar to build, but used when the server returns an absolute file path instead of a URL. This is useful when you are running a Bot API server, and you want to download files from a custom remote location instead of a local file system.
The function can still pass a URL, and the plugin will download the file instead of reading it from the file system.