.showModal is not a function

I use modals a bit and every once in the while I get the error TypeError: interaction.showModal is not a function now the modal still works like normal and there is no visual sign of an error etc. Is there any reason to why this could happen?
2 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Dominik
DominikOP17mo ago
Does it need to be from a buttoninteraction etc? Casue its still fully functional and everything but every once in a while that error gets logged Full error
0|WouldYou | TypeError: interaction.showModal is not a function
0|WouldYou | at Object.execute (/home/wouldyoubot/src/buttons/dailyInterval.js:30:17)
0|WouldYou | at module.exports (/home/wouldyoubot/src/events/interactionCreate.js:161:33)
0|WouldYou | at runMicrotasks (<anonymous>)
0|WouldYou | at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|WouldYou | TypeError: interaction.showModal is not a function
0|WouldYou | at Object.execute (/home/wouldyoubot/src/buttons/dailyInterval.js:30:17)
0|WouldYou | at module.exports (/home/wouldyoubot/src/events/interactionCreate.js:161:33)
0|WouldYou | at runMicrotasks (<anonymous>)
0|WouldYou | at processTicksAndRejections (node:internal/process/task_queues:96:5)
Code
const modalObject = {
title: "Daily Messages Interval",
custom_id: "dailyInterval",
components: [
{
type: 1,
components: [
{
type: 4,
style: 1,
custom_id: "input",
label: "Enter a 24 hour dailymsg interval (HH:MM).",
},
],
},
],
};

function isFormat(str) {
return /^(?:[01]\d|2[0-3]):(?:00|30)$/.test(str);
}

module.exports = {
data: {
name: "dailyInterval",
description: "Daily Interval customization",
},
async execute(interaction, client, guildDb) {
interaction.showModal(modalObject);
const modalObject = {
title: "Daily Messages Interval",
custom_id: "dailyInterval",
components: [
{
type: 1,
components: [
{
type: 4,
style: 1,
custom_id: "input",
label: "Enter a 24 hour dailymsg interval (HH:MM).",
},
],
},
],
};

function isFormat(str) {
return /^(?:[01]\d|2[0-3]):(?:00|30)$/.test(str);
}

module.exports = {
data: {
name: "dailyInterval",
description: "Daily Interval customization",
},
async execute(interaction, client, guildDb) {
interaction.showModal(modalObject);
Was just typing it out its a simple button and it does work like 90% of the time the other 10% it also works but throws that error Could do that yea tho its not a high priority Just wanted to see if someone else had a similar issue Hmm ill see if changing one of em fixes it Cant seem to reproduce it in dev
Want results from more Discord servers?
Add your server