Closed IxAlpha closed 2 years ago
Do you have the client.on('modalSubmit) method in the same file as the command? If so, what worked for me was moving that method to another file like main.js or with an event handler.
Do you have the client.on('modalSubmit) method in the same file as the command? If so, what worked for me was moving that method to another file like main.js or with an event handler.
Well, I've tried to do that so I wanted to use the interaction from the command, so I've tried to use parameters, but the same issue still appears, here's example, in the component collector:
const modalHandler = require('../../events/modalSubmit')
collector.on('collect', async (i) => {
if(i.customId === 'button') {
showModal({
client: client,
interaction: i
})
modalHandler(interaction, collector)
}
})
And the event file
const modalHandler = async (interaction, collector) => {
client.on('modalSubmit', async (modal) => {
// Th same event code goes here
}
}
module.exports = modalHandler
Do you have on the interactionCreate event a deferReply method?
Do you have on the interactionCreate event a deferReply method?
Well, I use command handler, I've used the interaction.deferReply()
first and then I've used followUp
to reply with the rows..
Like:
// On the top of the code
await interaction.deferReply()
// Some rows defining goes here...
// And now followUp with the components
const msg = await interaction.followUp({ ... })
Delete the deferReply method and if u have followUp or editReply methods on your commands change It by reply or limit this deferReply method to all your command except this one
But it's not caused from the command interaction.. I've marked from where does the error belongs to, when I use modal.deferReply()
for the second time, it errors
The problem is the thing that i said to you
Because the collector collect those interactions and you on your interactionCreate you deferReply that interaction and the error is because you cannot deferReply this interaction and use on the show Modal method
Try It and you Will se
You can do this instead of replace the followUp and editReply methods
if(!<cmd> === "your_modal_command"){
interaction.deferReply()
}
Alrighty, should I disable the interaction.deferReply()
from the command? And use interaction.reply()
instead?
This code says that if the Slash is not the modal Slash deferReply that interaction if not it doesn't deferReply that interaction and in this case the whole modal command
If you do not understand something let me know
I think is better on github so all the users that have this problem can solve it
Yeah true, anyways, I've tried to not to use Interaction#deferReply
and use Interaction#reply
like:
const msg = await interaction.reply({ components: [row5], content: `Weird buttons just showed up!`, ephemeral: false, fetchReply: true })
const collector = msg.createMessageComponentCollector({ time: 120000 })
But like uh, am bored like literally I don't know what to do, would be my pleasure if you explain me it step by step...
ps: I use Interaction#deferReply
in all of my commands not in the event itself
Whats the name of your command?
wordle
ok
if(!<cmd> === "wordle"){
await interaction.deferReply()
}
Like that and only you try the command and luckily it will works propertly
in cmd put how you define your command
okay I'll try
So it has differences if I deferReply
in the event or in the command file?
Well nope, still facing the issue...
Show your interactionCreate
@PabloRNC I'm having this same error, with nothing but the modalSubmit event giving a deferReply
you can contact me at 10KAIDAN#0001 on discord
Show me your command and your interactionCreate
@PabloRNC is it possible to edit the current message without following it up because the bot im making is using it like a ban reason and then edit the message saying banned successfully?
Mmm i do not know what do you mean if can provide some screenshots
@PabloRNC is it possible to edit the current message without following it up because the bot im making is using it like a ban reason and then edit the message saying banned successfully?
You can like modal.reply with fetchReply in true and then edit It like a interaction.reply method
@PabloRNC is it possible to edit the current message without following it up because the bot im making is using it like a ban reason and then edit the message saying banned successfully?
You can like modal.reply with fetchReply in true and then edit It like a interaction.reply method
i already changed to discord.js v14 and it had the necessary things with the function awaitModalSubmit
made it that i can edit current message without making it reply again
You can edit It with modal.interaction.message.edit on the discord -modals npm i think
I tried it and I just got undefined
On discord-modals is modal.update(...)
.
nvm djs v13.7 released already
So I've tried to use the collector interaction like:
The first time the command works fine, but the second time I use the command I get Discord API error with "interaction has been already acknowledged. Here's the modalSubmit event:
I am suffering this issue ages ago, idk what to do to solve it.. any solution??