#Not sure why my embed is failing.

21 messages · Page 1 of 1 (latest)

green mesa
#

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?

    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)
golden patioBOT
#

• 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.

green mesa
#

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

fiery crescent
#

the error is indeed correct. that method is non existent on an EmbedBuilder

green mesa
#

oh okay, does it exist on a message response?

fiery crescent
#

no. that would be on an ActionRowBuilder which you add components to. you would then pass components: […] when sending the action row and the button together

heavy martenBOT
green mesa
#

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!

fiery crescent
#

hehe np

green mesa
#

ok so, follow up on this.
Did I do this properly? because now I'm getting this error that I've never seen:

    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)```
gray trail
#

That’s not how it works

#

.addComponents(
new ButtonBuilder().set…(),
new ButtonBuilder().set…(),
)

#

Can you also npm ls for me and show the output please

green mesa
#

oooh okay so it would be like

      .setId('button1'),
  new ButtonBuilder()
      .setId('button2')

?

#

and yeah

gray trail
#

.setCustomId() but yh

green mesa
gray trail
#

All of that inside of .addComponents

gray trail
# green mesa

djs re-exports api-types and rest iirc, but that’s fine just leave it

green mesa
#

awesome! I'll give that a try. Thank you so much again

gray trail
#

All good