Skip to content
Files fileAttach

$fileAttach[]

$fileAttach reads a file of the bot and attaches it to the message the script sends, the same way $attachImage attaches a canvas. The message keeps its text.

Syntax

bdfd
$fileAttach[path;(name)]

The file must be at most 10 MB (the Discord limit for a bot), otherwise the function fails with file_too_large_to_attach. A file that does not exist fails with file_not_found; catch it with $try. Only the files of the bot itself can be attached.

Parameters

Parameter Description
path Required. Logical path of the file.
name Optional. Name shown in Discord. By default the end of the path. A name without an extension gets .bin.

Examples

Here is the export: $fileAttach[exports/week-12.csv;classement.csv]

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.