Not sure why my embed is failing.

Hello! I have an embed that I'm putting together and I'm getting a TypeError that I'm not quite sure I understand. Could someone help me understand what the error is trying to say?
TypeError: (intermediate value).setTitle(...).setDescription(...).setColor(...).setThumbnail(...).setTimestamp(...).addComponents is not a function
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\quiz.js:31:8)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:27)
at Client.<anonymous> (C:\Users\Owner\Desktop\BartleBot\src\functions\handlers\handleEvents.js:15:67)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:354:31)
at WebSocketManager.<anonymous> (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:238:12)
at WebSocketManager.emit (C:\Users\Owner\Desktop\BartleBot\node_modules\@vladfrangu\async_event_emitter\dist\index.js:282:31)
at WebSocketShard.<anonymous> (C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\ws\dist\index.js:1103:51)
TypeError: (intermediate value).setTitle(...).setDescription(...).setColor(...).setThumbnail(...).setTimestamp(...).addComponents is not a function
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\quiz.js:31:8)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:27)
at Client.<anonymous> (C:\Users\Owner\Desktop\BartleBot\src\functions\handlers\handleEvents.js:15:67)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:354:31)
at WebSocketManager.<anonymous> (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:238:12)
at WebSocketManager.emit (C:\Users\Owner\Desktop\BartleBot\node_modules\@vladfrangu\async_event_emitter\dist\index.js:282:31)
at WebSocketShard.<anonymous> (C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\ws\dist\index.js:1103:51)
17 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.
Snapper
SnapperOP2y ago
my best guess is that it doesn't like the components section for the buttons I'm making but I've seen this in example code that worked so I'm not sure where I went wrong
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Snapper
SnapperOP2y ago
oh okay, does it exist on a message response?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
guide Message Components: Sending buttons read more
Snapper
SnapperOP2y ago
okay that makes sense. Just because you're more familiar with the database do you have a page you could link me t- THANK YOU!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Snapper
SnapperOP2y ago
ok so, follow up on this. Did I do this properly? because now I'm getting this error that I've never seen:
TypeError: component.toJSON is not a function
at C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\builders\dist\index.js:1285:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\builders\dist\index.js:1285:35)
at C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\MessagePayload.js:136:109
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\MessagePayload.js:136:49)
at ChatInputCommandInteraction.reply (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:109:56)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\quiz.js:48:23)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:27)
at Client.<anonymous> (C:\Users\Owner\Desktop\BartleBot\src\functions\handlers\handleEvents.js:15:67)
TypeError: component.toJSON is not a function
at C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\builders\dist\index.js:1285:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\Owner\Desktop\BartleBot\node_modules\@discordjs\builders\dist\index.js:1285:35)
at C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\MessagePayload.js:136:109
at Array.map (<anonymous>)
at MessagePayload.resolveBody (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\MessagePayload.js:136:49)
at ChatInputCommandInteraction.reply (C:\Users\Owner\Desktop\BartleBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:109:56)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\commands\tools\quiz.js:48:23)
at Object.execute (C:\Users\Owner\Desktop\BartleBot\src\events\client\interactionCreate.js:12:27)
at Client.<anonymous> (C:\Users\Owner\Desktop\BartleBot\src\functions\handlers\handleEvents.js:15:67)
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Snapper
SnapperOP2y ago
oooh okay so it would be like
new ButtonBuilder()
.setId('button1'),
new ButtonBuilder()
.setId('button2')
new ButtonBuilder()
.setId('button1'),
new ButtonBuilder()
.setId('button2')
? and yeah
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Snapper
SnapperOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Snapper
SnapperOP2y ago
awesome! I'll give that a try. Thank you so much again
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
discord.js includes multiple sub-packages, installing these separately can mess with internal code:
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
npm uninstall discord-api-types @discordjs/rest @discordjs/builders
yarn remove discord-api-types @discordjs/rest @discordjs/builders
pnpm remove discord-api-types @discordjs/rest @discordjs/builders
Want results from more Discord servers?
Add your server