Some error that I do not understand
I have a code and it has a few problems. Even if it is not the console saying it, but you see something bad in it, tell me.
The console error is:
Unexpected error: TypeError: (intermediate value).setTitle(...).setDescription(...).addField is not a function
at askQuestion (D:\atermibot\index.js:130:26)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async Client.<anonymous> (D:\atermibot\index.js:142:9)
And the code is: https://sourceb.in/ot4siSAXRQ
11 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPHope that anyone can help me.
its addFields
oh so i just missed an 's'?
silly me let me try again
not really no, you are using an outdated method
you used it correctly before
I made it like that and that is the error: Unexpected error: CombinedPropertyError (2)
Received one or more errors
input[0]
| ValidationError > s.object(T)
| Expected the value to be an object, but received string instead
|
| Received:
| | 'Válaszok'
input[1]
| ValidationError > s.object(T)
| Expected the value to be an object, but received string instead
|
| Received:
| | 'A, D, C, A'
at _ArrayValidator.handle (D:\atermibot\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:1205:70)
at _ArrayValidator.parse (D:\atermibot\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:939:90)
at EmbedBuilder.addFields (D:\atermibot\node_modules@discordjs\builders\dist\index.js:228:31)
at askQuestion (D:\atermibot\index.js:130:26)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async askQuestion (D:\atermibot\index.js:113:21)
at async Client.<anonymous> (D:\atermibot\index.js:142:9)
it takes an array of APIEmbedField
Wdym
So how do i correct it
you use the correct syntex
just like you did on line 88
oh right
let me try again.
So is this like this? const resultEmbed = new EmbedBuilder()
.setTitle("Kérdőív Eredmény")
.setDescription(
${message.author.username} válaszai a következőek voltak:
)
.addFields(
{ name: "Válaszok", value: answers.join(', ') },
{ name: "Idő", value: new Date().toLocaleString() }
)yes