#Slash Commands

1 messages · Page 1 of 1 (latest)

indigo portalBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

compact sluice
#
ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
north bone
#

Where should it be set? Command file? Or index

compact sluice
#

Your start file, so yes, your index

north bone
#

and const { ApplicationCommandRegistries, RegisterBehavior } = require('@sapphire/framework');

#

Right?

compact sluice
#

Yes

north bone
#

And how should I setup my command file?

const { Command } = require('@sapphire/framework');


module.exports = class PingCommand extends Command {
    constructor(context, options) {
        super(context, {
            ...options,
            name: 'ping',
            description: 'Replies with Pong!',
        
        });
    }


  async messageRun(message) {
    const msg = await message.channel.send('Ping?');
    const ping = msg.createdTimestamp - message.createdTimestamp;
    await msg.edit(`Pong! Latency is **${ping}ms.** API Latency is **${Math.round(this.container.client.ws.ping)}ms**`);
  }

  async chatInputRun(interaction) {
    const msg = await interaction.reply({ content: 'Ping?', fetchReply: true });
    const ping = msg.createdTimestamp - interaction.createdTimestamp;
    await interaction.editReply(`Pong! Latency is **${ping}ms.** API Latency is **${Math.round(this.container.client.ws.ping)}ms**`);
  }
    
};
compact sluice
#

Set it up for what

north bone
#

I mean I have do something here for slash command right? or the one line I set index.js is enough!

compact sluice
#

That is all you have to do

north bone
#

I can't see my slash commands in my server

compact sluice
#

Restart Discord

north bone
#

ApplicationCommandRegistries(BulkOverwrite) Successfully overwrote global application commands. The application now has 0 global commands

compact sluice
#

Send me a screenshot of your folder structure

north bone
#

register-commands.js file is inactive. I tried myself to register slash commands on every bot restart. (though it didnt work so removed the file from start file)

compact sluice
north bone
#

No.

#

Didn't work previously as well.

compact sluice
#

You need to follow the guide then

#

I can see several issues just by looking at your folder structure

north bone
#

Doesn't sapphire framework support subfolder commands?

compact sluice
#

Your events folder will not do anything. It is supposed to be named as listeners but thats just one of the issues

north bone
#

I had this before. It logged in the console that the slash command is regestered with e hintID. Though I couldn't see any slash commands in my server.

compact sluice
#

If you read the guide you would understand this

north bone
compact sluice
#

Please read the guide, I have told you several times now. It barely takes 20 minutes, probably less. Good luck

north bone
#

what about preconditions. Not working either

#

the command isn't responding

compact sluice
#

Your files/folders need to be located in a src folder

north bone
#

It was previously in src/preconditions/devOnly.js

#

didnt work and then removed src to check whether it works or not

hushed quiver
#

This entire thread is based upon an issue that isn't even the actual issue

#

Your commands never showed up to begin with, your thread is talking about registery behavior and now you are talking about preconditions