deferReply issue

const utils = require("../utils/utils");
const embed = require("../utils/embed");
const loaders = require("../utils/loaders");
const EventBuild = require("../utils/event");

module.exports = new EventBuild(
"commandInteraction",
"interactionCreate",
async (interaction) => {
if(interaction.isCommand( )) {
await interaction.deferReply({ ephemeral: true });

const name = interaction.commandName;

if(!name) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: "You need to inform the command that you want to use."
})]
});
};

const command = loaders.commands.find((command) => {
return command.name == name;
});

if (!command) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! I couldn't find the command '${name}'.`
})]
});
};

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing command '${command.name}':`, error);

return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! An error occurred while I tried to execute the command.`
})]
});
};
};
}
);
const utils = require("../utils/utils");
const embed = require("../utils/embed");
const loaders = require("../utils/loaders");
const EventBuild = require("../utils/event");

module.exports = new EventBuild(
"commandInteraction",
"interactionCreate",
async (interaction) => {
if(interaction.isCommand( )) {
await interaction.deferReply({ ephemeral: true });

const name = interaction.commandName;

if(!name) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: "You need to inform the command that you want to use."
})]
});
};

const command = loaders.commands.find((command) => {
return command.name == name;
});

if (!command) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! I couldn't find the command '${name}'.`
})]
});
};

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing command '${command.name}':`, error);

return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! An error occurred while I tried to execute the command.`
})]
});
};
};
}
);
with this code im either getting the error https://pastebin.com/fPdH2ver or its just not editing deferReplies
Pastebin
```node:events:496 throw er; // Unhandled 'error' event ^...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
13 Replies
d.js toolkit
d.js toolkit8mo 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!
Melo
MeloOP8mo ago
hey, can we continue in #djs-help-v14 ? i accidentally sent it there and they're helping me now @Qjuh @Zerls @NyR thats the forum
Melo
MeloOP8mo ago
https://pastebin.com/p2xDmNXK - uilts.js (editOrReply) https://pastebin.com/CfFRmYgK - commandIinteraction https://pastebin.com/v6JCKefc - command
Pastebin
const fs = require("fs");const embed = require("./embed");const { C...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
const utils = require("../utils/utils");const embed = require("../u...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
const { SlashCommandBuilder } = require("discord.js");const SlashBu...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Melo
MeloOP8mo ago
these are the codes rn
Zerls
Zerls8mo ago
can you send your most recent log of your last test run?
Melo
MeloOP8mo ago
Pastebin
Interaction received: ChatInputCommandInteraction { type: 2, id: ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Melo
MeloOP8mo ago
here command did not edit the reply
Zerls
Zerls8mo ago
and the reply was edited to "Calculating" correct
Melo
MeloOP8mo ago
yeah, the defer reply was supposed to edit to calculating
Zerls
Zerls8mo ago
supposed to or it did?
Melo
MeloOP8mo ago
supposed to, like I said it did not edit the reply didnt work they were all working something that I dont know happened and now nothing works anymore
Zerls
Zerls8mo ago
it doesnt magically stop working
Melo
MeloOP8mo ago
im using my mother's pc, no vscode here well, thats exactly what happened now im coding it directly via the host that i use bro, idk whats going on but its working normally now ill keep this forum open if something happens it broke again i honestly dont know and it broke again oh i confused myself, i just zip my code, send to the host and then unzip the folder with all my other folders n codes i can create files n folders and then just code ptero editor any other question?
Want results from more Discord servers?
Add your server