pal3st1na
pal3st1na
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/13/2024 in #djs-questions
search function
Oh, well, thank you!
7 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
It seems to me that I am doing something wrong, I entered your code into mine, logs in the console that the modal form has been sent, but still issues errors when users send this modal form after me, the error pops up when the 2nd user sends, and if the 3rd sends, then the bot will crash console =>
submitTaskModal-680046529733459980-1733326045987 was submitted!
submitTaskModal-1232719397794091038-1733326067283 was submitted!
Error handling interaction: DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:831:23)
at async _REST.request (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:1272:22)
at async ModalSubmitInteraction.deferReply (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:72:5)
at async Client.<anonymous> (C:\Users\ivale\Desktop\obl.ds.bott\src\commands\batlepass\tasks.js:258:7) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1313889510232293386/aW50ZXJhY3Rpb246MTMxMzg4OTUxMDIzMjI5MzM4NjpjVXZ2WWRhakM5WHdYemFIZFg2ZmlNZVlINDV4WmlKVUdCS29TbkN2RVk3d1Jwak8xOVRCNDFHbG44Rkp2OUw3bnB1UlZlZUdHWlZ3bXRNbFlnTHNtdEliYmJLdmpySnZxMG91NGx3cnNXUk9UbFNlS2Vnc2wwQjRIa2YwRWZvQw/callback'
}
submitTaskModal-680046529733459980-1733326045987 was submitted!
submitTaskModal-1232719397794091038-1733326067283 was submitted!
Error handling interaction: DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:831:23)
at async _REST.request (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\@discordjs\rest\dist\index.js:1272:22)
at async ModalSubmitInteraction.deferReply (C:\Users\ivale\Desktop\obl.ds.bott\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:72:5)
at async Client.<anonymous> (C:\Users\ivale\Desktop\obl.ds.bott\src\commands\batlepass\tasks.js:258:7) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: {
message: 'Interaction has already been acknowledged.',
code: 40060
},
code: 40060,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1313889510232293386/aW50ZXJhY3Rpb246MTMxMzg4OTUxMDIzMjI5MzM4NjpjVXZ2WWRhakM5WHdYemFIZFg2ZmlNZVlINDV4WmlKVUdCS29TbkN2RVk3d1Jwak8xOVRCNDFHbG44Rkp2OUw3bnB1UlZlZUdHWlZ3bXRNbFlnTHNtdEliYmJLdmpySnZxMG91NGx3cnNXUk9UbFNlS2Vnc2wwQjRIa2YwRWZvQw/callback'
}
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
I think I fixed it in the handler. console.log gives out the id of the person who interacts every time, but the problem remains the same, when someone second after me starts interacting, the bot crashes
interaction.client.on("interactionCreate", async (interaction) => {
try {
if (interaction.type === InteractionType.ModalSubmit && interaction.customId.startsWith("submitTaskModal-")) {
const uniqueId = interaction.customId.split('-')[1];

if (interaction.replied || interaction.deferred) return;

await interaction.deferReply({ ephemeral: true });

const taskInput = interaction.fields.getTextInputValue("taskInput");
const proofLink = interaction.fields.getTextInputValue("proofLink");

console.log(`Processing submission with uniqueId: ${uniqueId}`);
interaction.client.on("interactionCreate", async (interaction) => {
try {
if (interaction.type === InteractionType.ModalSubmit && interaction.customId.startsWith("submitTaskModal-")) {
const uniqueId = interaction.customId.split('-')[1];

if (interaction.replied || interaction.deferred) return;

await interaction.deferReply({ ephemeral: true });

const taskInput = interaction.fields.getTextInputValue("taskInput");
const proofLink = interaction.fields.getTextInputValue("proofLink");

console.log(`Processing submission with uniqueId: ${uniqueId}`);
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
else if (i.customId === "completeTask") {
const uniqueId = `${interaction.user.id}-${Date.now()}`; // Unique identifier
const modal = new ModalBuilder()
.setCustomId(`submitTaskModal-${uniqueId}`)
.setTitle("Submit Task")
.addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("taskInput")
.setLabel("Enter task (format: W1, R1)")
.setStyle(TextInputStyle.Short)
.setPlaceholder("Example: W1, R1")
.setRequired(true)
),
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("proofLink")
.setLabel("Proof link")
.setStyle(TextInputStyle.Short)
.setPlaceholder("Example: https://i.imgur.com/bWhx7OT.png")
.setRequired(false)
)
);

await i.showModal(modal);
return;
}
else if (i.customId === "completeTask") {
const uniqueId = `${interaction.user.id}-${Date.now()}`; // Unique identifier
const modal = new ModalBuilder()
.setCustomId(`submitTaskModal-${uniqueId}`)
.setTitle("Submit Task")
.addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("taskInput")
.setLabel("Enter task (format: W1, R1)")
.setStyle(TextInputStyle.Short)
.setPlaceholder("Example: W1, R1")
.setRequired(true)
),
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("proofLink")
.setLabel("Proof link")
.setStyle(TextInputStyle.Short)
.setPlaceholder("Example: https://i.imgur.com/bWhx7OT.png")
.setRequired(false)
)
);

await i.showModal(modal);
return;
}
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
No, unfortunately it didn't help. After launching the bot, I send a modal form from one discord account, everything is fine with it and there are no errors in the process, but if someone decides to send another modal form after me, the bot will crash By issuing errors in the console DiscordAPIError[40060]: Interaction has already been acknowledged. DiscordAPIError[10062]: Unknown interaction
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
Do you know what this might be related to?:Frogroll:
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
Thank you, this solved the problem when switching pages, sorry, but what about modal forms? they also have such errors when sending
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
The code in most spaghetti:akpopKrinj:
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
it seems to have been published https://pastebin.com/zMegmhvN
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
ok!
24 replies
DIAdiscord.js - Imagine an app
Created by pal3st1na on 12/3/2024 in #djs-questions
Ephemeral messages
I can send the file in the format.js, many lines
24 replies