messages.downloadAttachment()
Save file to local computer. Initiates a browser download.
Definition
client.messages.downloadAttachment(messageId: string|Message,attachmentId: string|number,options: ?Object,):Promise<void,Error>
Parameters
Parameter | Type | Description |
---|---|---|
messageId | string |Message | Message ID |
attachmentId | string |number | Attachment ID |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
options.fileName | string | Optional file name used to initiate file save prompt |
Response
This function does not return anything, it prompts the browser to save the attachment.
Example
await client.messages.downloadAttachment(message.id, message.attachments[0].id);