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 toolkit2y 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
SpecialSauce2y ago
🔼
Soap
SoapOP2y ago
?
SpecialSauce
SpecialSauce2y 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
SoapOP2y 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
SpecialSauce2y ago
Expected a string primitive Received [Attachment]
Soap
SoapOP2y ago
what does that even mean
SpecialSauce
SpecialSauce2y ago
Url needs to be a string But you sent an attachment
d.js docs
d.js docs2y ago
property Attachment#url The URL to this attachment
Soap
SoapOP2y ago
how do i make it a string then
SpecialSauce
SpecialSauce2y ago
Reference the url property of the attachment
Soap
SoapOP2y ago
like this? iconURL: interaction.options.url.getAttachment("authoricon"),
SpecialSauce
SpecialSauce2y ago
getAttachment() returns the attachment options.url doesn’t exist.
Soap
SoapOP2y ago
ah so this:? iconURL: interaction.options.getAttachment("authoricon").url
SpecialSauce
SpecialSauce2y ago
Should be
Soap
SoapOP2y ago
ty it worked!
Want results from more Discord servers?
Add your server