#Slash Command

22 messages · Page 1 of 1 (latest)

potent python
ivory mulch
#

What’s the error

#

make sure you register the command

potent python
#

@ivory mulch I didn't get any error. It's just not working.

I did register the command.

potent python
#

@ivory mulch Wait, I sent the wrong link.

torpid oasis
#

@potent python Please do not ping someone on every message.

ivory mulch
#

and see if it actually runs it

torpid oasis
# potent python ?...

When you @username someone, it's a ping. You don't need to do it it three times within a minute.

ivory mulch
potent python
potent python
# ivory mulch Without any actual reference to where it’s breaking, i can’t really help tbh.

How would I restructure this code

import { CommandInteraction, SlashCommandBuilder } from "discord.js";

export const data = new SlashCommandBuilder()
  .setName("ping")
  .setDescription("Replies with Pong!");

export async function execute(interaction: CommandInteraction) {
  return interaction.reply("Pong!");
}

like such:

    import { CommandInteraction, Client } from "discord.js";
import { Command } from "../Command";

export const Hello: Command = {
    name: "hello",
    description: "Returns a greeting",
    type: "CHAT_INPUT",
    run: async (client: Client, interaction: CommandInteraction) => {
        const content = "Hello there!";

        await interaction.followUp({
            ephemeral: true,
            content
        });
    }
};
ivory mulch
#

i believe slash command builder already does most of the formatting

#

look at your slash command handler and see if it’s running

potent python
#

@ivory mulch I think I figured out the issue. When I run, "node index.js," the bot runs. However, when I try to run it from the command, "npm start dev," I get an error: "dotenv_1.dotenv.config(); ^ TypeError: Cannot read properties of undefined (reading 'config')."

ivory mulch
#

maybe wrong quotes but yk

potent python
ivory mulch