Modal help

const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
im getting error const modal = new ModalBuilder() ^ TypeError: ModalBuilder is not a constructor
10 Replies
d.js docs
d.js docs2y 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.
Mulo
Mulo2y ago
TypeError: ModalBuilder is not a constructor at Client.<anonymous> (/home/ubuntu/discord/logibot.js:95:18) at Client.emit (node:events:390:28) at InteractionCreateAction.handle (/home/ubuntu/discord/node_modules/discord.js/src/client/actions/InteractionCreate.js:83:12) at Object.module.exports [as INTERACTION_CREATE] (/home/ubuntu/discord/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36) at WebSocketManager.handlePacket (/home/ubuntu/discord/node_modules/discord.js/src/client/websocket/WebSocketManager.js:346:31) at WebSocketShard.onPacket (/home/ubuntu/discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:478:22) at WebSocketShard.onMessage (/home/ubuntu/discord/node_modules/discord.js/src/client/websocket/WebSocketShard.js:317:10) at WebSocket.onMessage (/home/ubuntu/discord/node_modules/ws/lib/event-target.js:199:18) at WebSocket.emit (node:events:390:28) at Receiver.receiverOnMessage (/home/ubuntu/discord/node_modules/ws/lib/websocket.js:1169:20) Node.js v17.3.0
const { Client, Intents, MessageEmbed, ContextMenuInteraction, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
const { Client, Intents, MessageEmbed, ContextMenuInteraction, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
duck
duck2y ago
What's your exact discord.js npm list discord.js and node node -v version?
mainly the what djs version part
Mulo
Mulo2y ago
"discord.js": "^13.8.1",
duck
duck2y ago
well the builders aren't exported directly from djs in v13 you're free to just use the Modal, MessageActionRow, and TextInputComponent classes
Mulo
Mulo2y ago
got a documentation url for that previous version?
duck
duck2y ago
they're both on the same website, you just have to change the branch to your specific version or stable for latest v13
Mulo
Mulo2y ago
ya was looking for an example code like is now live for v14
duck
duck2y ago
well you're welcome to check out that second link which is the v13 guide it has a section on modals (and includes example code for that)