YellowLink
DIAdiscord.js - Imagine an app
•Created by YellowLink on 12/4/2024 in #djs-questions
TypeError at _transformAPIMessageInteractionMetadata
I'm having a strange error and can't seem to find anyone who's had this same problem.
async handleModal(interaction) {
if (interaction.customId === 'quizModal') {
const userInput = interaction.fields.getTextInputValue('answerInput');
const checkAnswer = input => {
return input.toLowerCase() === userInput.toLowerCase();
};
const correctAnswer = quoteOutput.answers.some(checkAnswer);
console.log(correctAnswer);
await interaction.reply({ content: `<@${interaction.user.id}> answered: \`${userInput}\`:
The correct answer is...`, components: [] });
await wait(2000);
if (correctAnswer) {
const winEmbed = new EmbedBuilder()
.setColor(0xFF69B4)
.setTitle('Your quote is:')
.setDescription(`${quoteOutput.quote}
Are you ready to play?`)
.setFooter({ text: '(game won!)' });
await interaction.followUp(`\`${quoteOutput.id.charAt(0).toUpperCase() + quoteOutput.id.slice(1)}\`, YOU WIN!!`);
await initialReply.edit({ embeds: [winEmbed], components: [] });
initialReply = '';
}
else {
const loseEmbed = new EmbedBuilder()
.setColor(0xFF69B4)
.setTitle('Your quote is:')
.setDescription(`${quoteOutput.quote}
Are you ready to play?`)
.setFooter({ text: '(game lost...)' });
await interaction.followUp(`\`${quoteOutput.id.charAt(0).toUpperCase() + quoteOutput.id.slice(1)}\`, YOU LOSE!! BOOO`);
await initialReply.edit({ embeds: [loseEmbed], components: [] });
initialReply = '';
}
}
},
async handleModal(interaction) {
if (interaction.customId === 'quizModal') {
const userInput = interaction.fields.getTextInputValue('answerInput');
const checkAnswer = input => {
return input.toLowerCase() === userInput.toLowerCase();
};
const correctAnswer = quoteOutput.answers.some(checkAnswer);
console.log(correctAnswer);
await interaction.reply({ content: `<@${interaction.user.id}> answered: \`${userInput}\`:
The correct answer is...`, components: [] });
await wait(2000);
if (correctAnswer) {
const winEmbed = new EmbedBuilder()
.setColor(0xFF69B4)
.setTitle('Your quote is:')
.setDescription(`${quoteOutput.quote}
Are you ready to play?`)
.setFooter({ text: '(game won!)' });
await interaction.followUp(`\`${quoteOutput.id.charAt(0).toUpperCase() + quoteOutput.id.slice(1)}\`, YOU WIN!!`);
await initialReply.edit({ embeds: [winEmbed], components: [] });
initialReply = '';
}
else {
const loseEmbed = new EmbedBuilder()
.setColor(0xFF69B4)
.setTitle('Your quote is:')
.setDescription(`${quoteOutput.quote}
Are you ready to play?`)
.setFooter({ text: '(game lost...)' });
await interaction.followUp(`\`${quoteOutput.id.charAt(0).toUpperCase() + quoteOutput.id.slice(1)}\`, YOU LOSE!! BOOO`);
await initialReply.edit({ embeds: [loseEmbed], components: [] });
initialReply = '';
}
}
},
10 replies