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
iconURL: interaction.options.getAttachment("authoricon") but when i put an attachment into the authoricon option, it errors
16 Replies
• 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.🔼
?
• 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.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)
Expected a string primitive
Received [Attachment]
what does that even mean
Url needs to be a string
But you sent an attachment
how do i make it a string then
Reference the url property of the attachment
like this?
iconURL: interaction.options.url.getAttachment("authoricon"),
getAttachment() returns the attachment
options.url doesn’t exist.
ah so this:?
iconURL: interaction.options.getAttachment("authoricon").url
Should be
ty it worked!