#Slash Commands
1 messages · Page 1 of 1 (latest)
ApplicationCommandRegistries.setDefaultBehaviorWhenNotIdentical(RegisterBehavior.BulkOverwrite);
Where should it be set? Command file? Or index
Your start file, so yes, your index
and const { ApplicationCommandRegistries, RegisterBehavior } = require('@sapphire/framework');
Right?
Yes
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**`);
}
};
Set it up for what
I mean I have do something here for slash command right? or the one line I set index.js is enough!
That is all you have to do
I can't see my slash commands in my server
Restart Discord
ApplicationCommandRegistries(BulkOverwrite) Successfully overwrote global application commands. The application now has 0 global commands
Send me a screenshot of your folder structure
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)
Were any of your commands ever registering before you started it using this?
You need to follow the guide then
I can see several issues just by looking at your folder structure
Such as?
Doesn't sapphire framework support subfolder commands?
Your events folder will not do anything. It is supposed to be named as listeners but thats just one of the issues
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.
If you read the guide you would understand this
ok lets avoid this because I didnt work on it yet. whats about the commands
Please read the guide, I have told you several times now. It barely takes 20 minutes, probably less. Good luck
Your files/folders need to be located in a src folder