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.`
          })]
        });
      };
    };
  }
);


with this code im either getting the error

https://pastebin.com/fPdH2ver or its just not editing deferReplies
Pastebin
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.
Was this page helpful?