Can buttons and action row be created as objects?

So I know you can create embeds using objects, I was wondering if the same could be done with action rows or buttons.
13 Replies
d.js docs
d.js docs3y 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.
MrMythical
MrMythical3y ago
yes
d.js docs
d.js docs3y ago
interface BaseMessageOptions The base message options for messages.
MrMythical
MrMythical3y ago
well the docs I sent doesn't really prove anything .-.
Jerimiah
JerimiahOP3y ago
const row = {
components: [
{
id: ...
},
]
};
const row = {
components: [
{
id: ...
},
]
};
something like this
MrMythical
MrMythical3y ago
custom_id iirc
Jerimiah
JerimiahOP3y ago
ah okay
MrMythical
MrMythical3y ago
yeah I think they're in snake_case
Jerimiah
JerimiahOP3y ago
D:\discord bots\hawk-bot\node_modules\discord.js\src\util\Components.js:114
throw new Error(`Found unknown component type: ${data.type}`);
^
Error: Found unknown component type: undefined
at createComponentBuilder (D:\discord bots\hawk-bot\node_modules\discord.js\src\util\Components.js:114:13)
at D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\ActionRowBuilder.js:15:77
at Array.map (<anonymous>)
at new ActionRowBuilder (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\ActionRowBuilder.js:15:31)
at D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\MessagePayload.js:137:84
at Array.map (<anonymous>)
at MessagePayload.resolveBody (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\MessagePayload.js:137:49)
at DMChannel.send (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:61)
at User.send (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:163:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
D:\discord bots\hawk-bot\node_modules\discord.js\src\util\Components.js:114
throw new Error(`Found unknown component type: ${data.type}`);
^
Error: Found unknown component type: undefined
at createComponentBuilder (D:\discord bots\hawk-bot\node_modules\discord.js\src\util\Components.js:114:13)
at D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\ActionRowBuilder.js:15:77
at Array.map (<anonymous>)
at new ActionRowBuilder (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\ActionRowBuilder.js:15:31)
at D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\MessagePayload.js:137:84
at Array.map (<anonymous>)
at MessagePayload.resolveBody (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\MessagePayload.js:137:49)
at DMChannel.send (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:61)
at User.send (D:\discord bots\hawk-bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:163:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
MrMythical
MrMythical3y ago
yeah using component builders is better but you need to set the type
Jerimiah
JerimiahOP3y ago
setting the type to ButtonComponent
MrMythical
MrMythical3y ago
set it to ComponentType.Button
Jerimiah
JerimiahOP3y ago
Alright got it working thanks alot!
Want results from more Discord servers?
Add your server