Skip to content
Responses addAttachment

$addAttachment

$addAttachment attaches a file to the response: a normal message, a slash command answer, a button or select menu answer, a deferred answer. The file is downloaded from the address and sent with the message. 8 MB at most.

It is the same function as $attachment[] with an optional name. To attach a file of the bot, use $fileAttach[]; to attach a canvas, $attachImage[].

Syntax

$addAttachment[url;(name)]

Parameters

Parameter Description
url Required. Address of the file.
name Optional. File name shown in Discord, with its extension. By default the end of the address.

Errors

  • The file cannot be loaded.: the address did not return a file.
  • A file is at most 8 MB.

Examples

Here is the logo.
$addAttachment[https://example.com/logo.png]

Show the attached file as a component of a Components V2 message:

$addAttachment[https://example.com/report.pdf;report.pdf]
$addContainer[box]
$addTextDisplay[Monthly report;box]
$addFile[report.pdf;no;box]

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.