#`options attachments` array contains

1 messages · Page 1 of 1 (latest)

manic ocean
#

i console.log(options) and it return me this:

  message: 'ogarnąłem trch komende z permisjami (front)\n' +
    'zostało mi zrobić backend i będzie tyle na dziś ![KEKW](https://cdn.discordapp.com/emojis/942397900393168896.webp?size=128 "KEKW")',
  embeds: [],
  attachments: [
    {
      id: '1046501359110848603',
      filename: 'image.png',
      size: 72131,
      url: 'https://cdn.discordapp.com/attachments/997275526974689450/1046501359110848603/image.png',
      proxy_url: 'https://media.discordapp.net/attachments/997275526974689450/1046501359110848603/image.png',
      width: 637,
      height: 547,
      content_type: 'image/png'
    }
  ],
  components: [ { type: 1, components: [Array] } ],
  mentions: false,
  name: 'Darek',
  icon: 'https://cdn.discordapp.com/avatars/637206828572475392/a_f42e053328ff97bbcb5b9eb8c7628964.gif'
}

#

options.attachments is not undefined

patent lynxBOT
sterile dirge
#

Nothing there's matches your data

manic ocean
#

ik ab it

#
console.log(options.attachments)
                return await hook.send({
                    content: options.message,
                    username: options.name,
                    avatarURL: options.icon,
                    embeds: options.embeds,
                    files: options.attachments,
                    components: options.components,
                    allowedMentions: {parse: []}
                });
#

i used files

#

in message options

#

and options.attachments is right

#

but i got error

#
TypeError: Cannot read properties of undefined (reading 'path')
    at findName (C:\Users\pawli\Desktop\thunder-shards\node_modules\discord.js\src\structures\MessagePayload.js:244:17)
    at MessagePayload.resolveFile (C:\Users\pawli\Desktop\thunder-shards\node_modules\discord.js\src\structures\MessagePayload.js:258:31)
    at C:\Users\pawli\Desktop\thunder-shards\node_modules\discord.js\src\structures\MessagePayload.js:225:85
    at Array.map (<anonymous>)
    at MessagePayload.resolveFiles (C:\Users\pawli\Desktop\thunder-shards\node_modules\discord.js\src\structures\MessagePayload.js:225:56)
    at Webhook.send (C:\Users\pawli\Desktop\thunder-shards\node_modules\discord.js\src\structures\Webhook.js:221:50)
    at Object.sendWebhook (C:\Users\pawli\Desktop\thunder-shards\src\lib\Utils\Functions.js:62:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
sterile dirge
#

The data in options.attachments is not what files array expected to be.

manic ocean
#

options.attachments includes file (image)

#
{
      id: '1046501359110848603',
      filename: 'image.png',
      size: 72131,
      url: 'https://cdn.discordapp.com/attachments/997275526974689450/1046501359110848603/image.png',
      proxy_url: 'https://media.discordapp.net/attachments/997275526974689450/1046501359110848603/image.png',
      width: 637,
      height: 547,
      content_type: 'image/png'
    }
#

its file

sterile dirge
#

This object is not BufferResolvable, JSONEncodable<AttachmentPayload>, Attachment or AttachmentBuilder

manic ocean
#

then what i must do?

sterile dirge
#

Map it to url. URL is BufferResolvable

manic ocean
#

Yeah that work

#

thank you very much