modalsubmitinteraction message null

title. why?
11 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.
⚡AmirhN
⚡AmirhNOP3y ago
invoking it from a context menu interaction.
Yinoguns
Yinoguns3y ago
A bit of code, please?
⚡AmirhN
⚡AmirhNOP3y ago
const modal = new ModalBuilder()
.setCustomId('msgReport')
.setTitle('Report Message');
const reason = new TextInputBuilder()
.setCustomId('reason')
.setLabel("Why are you reporting this message?")
.setRequired(true)
.setMinLength(4)
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(reason);
modal.addComponents(firstActionRow);
await interaction.showModal(modal);
const modal = new ModalBuilder()
.setCustomId('msgReport')
.setTitle('Report Message');
const reason = new TextInputBuilder()
.setCustomId('reason')
.setLabel("Why are you reporting this message?")
.setRequired(true)
.setMinLength(4)
.setStyle(TextInputStyle.Paragraph);
const firstActionRow = new ActionRowBuilder().addComponents(reason);
modal.addComponents(firstActionRow);
await interaction.showModal(modal);
calling modal
name: 'interactionCreate',
async execute(interaction) {
if (!interaction.isModalSubmit()) return;
if (interaction.customId === 'msgReport') {
console.log(interaction);
return;
name: 'interactionCreate',
async execute(interaction) {
if (!interaction.isModalSubmit()) return;
if (interaction.customId === 'msgReport') {
console.log(interaction);
return;
reading it.
message:
null
replied:
false
type:
5
message:
null
replied:
false
type:
5
prints
chewie
chewie3y ago
why would it have a message a modal interaction isn't bound to any message
Yinoguns
Yinoguns3y ago
I like how you show a log of message, but not tje code that logs it. But yea, modals are not messages, what did you expect?
⚡AmirhN
⚡AmirhNOP3y ago
oh, hmm, i remember i used it on some other codes, lemme try oh i used to just update the message with the modals, like this interaction.update({embeds: [_embed]}); so, is there any way to get message of it?
chewie
chewie3y ago
you will have to get the message some other way, modals have to relation to messages
⚡AmirhN
⚡AmirhNOP3y ago
kk will do something, thanks
chewie
chewie3y ago
why dont you just use awaitModalSubmit in your context command
⚡AmirhN
⚡AmirhNOP3y ago
hmm that's a good idea ty! will close it
Want results from more Discord servers?
Add your server