Files
fileURL
$fileURL[]
$fileURL returns a signed link that anyone who has it can open until it expires, without any account. Images, audio, video, plain text and PDF open in the browser, any other type (HTML included) is downloaded. A link stops working when the file is deleted; if the file is replaced, the link serves the new content.
Syntax
bdfd
$fileURL[path;(minutes)]
On desktop, a bot that runs locally has no public link: the function fails with file_url_unavailable.
Parameters
| Parameter | Description |
|---|---|
path |
Required. Logical path of the file. |
minutes |
Optional. Lifetime of the link, 60 by default, 10080 (7 days) at most. Write permanent for a link that never expires: it works until the file is deleted. |
Examples
Download your export (valid 30 minutes): $fileURL[exports/week-12.csv;30]
$setUserVar[avatar;$fileURL[avatars/$authorID.png;permanent]]
Anyone who has a permanent link can open the file, so use it for files meant to be shown, such as images.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.