attachment option

I have this bit of code,
iconURL: interaction.options.getAttachment("authoricon") but when i put an attachment into the authoricon option, it errors
16 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
SpecialSauce
SpecialSauce15mo ago
🔼
Soap
Soap15mo ago
?
SpecialSauce
SpecialSauce15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Soap
Soap15mo ago
node: v18.15.0 CombinedPropertyError (1) Received one or more errors input.iconURL | CombinedError (2) | Received one or more errors | | 1 ValidationError > s.nullish | | Expected undefined or null | | | | Received: | | | [Attachment] | | 2 ValidationError > s.string | | Expected a string primitive | | | | Received: | | | [Attachment] at ObjectValidator.handleIgnoreStrategy (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules@sapphire\shapeshift\dist\index.js:1263:70) at ObjectValidator.handleStrategy (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules@sapphire\shapeshift\dist\index.js:1116:47) at ObjectValidator.handle (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules@sapphire\shapeshift\dist\index.js:1216:17) at ObjectValidator.parse (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules@sapphire\shapeshift\dist\index.js:207:88) at EmbedBuilder.setAuthor (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules@discordjs\builders\dist\index.js:278:26) at Object.execute (C:\Users\csc21\OneDrive\Desktop\soapjs\src\commands\tools\embedbuilder.js:21:8) at Object.execute (C:\Users\csc21\OneDrive\Desktop\soapjs\src\events\client\interactionCreate.js:10:23) at Client.<anonymous> (C:\Users\csc21\OneDrive\Desktop\soapjs\src\functions\handlers\handleEvents.js:20:23) at Client.emit (node:events:513:28) at InteractionCreateAction.handle (C:\Users\csc21\OneDrive\Desktop\soapjs\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
SpecialSauce
SpecialSauce15mo ago
Expected a string primitive Received [Attachment]
Soap
Soap15mo ago
what does that even mean
SpecialSauce
SpecialSauce15mo ago
Url needs to be a string But you sent an attachment
d.js docs
d.js docs15mo ago
property Attachment#url The URL to this attachment
Soap
Soap15mo ago
how do i make it a string then
SpecialSauce
SpecialSauce15mo ago
Reference the url property of the attachment
Soap
Soap15mo ago
like this? iconURL: interaction.options.url.getAttachment("authoricon"),
SpecialSauce
SpecialSauce15mo ago
getAttachment() returns the attachment options.url doesn’t exist.
Soap
Soap15mo ago
ah so this:? iconURL: interaction.options.getAttachment("authoricon").url
SpecialSauce
SpecialSauce15mo ago
Should be
Soap
Soap15mo ago
ty it worked!