How do i delete a slash command?

I Accidentally Created A Slash Command. how do i remove it?
Solution:
Slash Commands GUI
Graphical User Interface to explore and edit your bot's slash commands!
Jump to solution
61 Replies
Alexandre
Alexandre•3y ago
Use discordjs like that
GattoDev (dev comms open)
import discordjs then remove it...?
Alexandre
Alexandre•3y ago
With sapphire you can't
GattoDev (dev comms open)
can you remove only 1 slash command?
Alexandre
Alexandre•3y ago
When you use body: [], you remove the all slash command I think you can, I power on my computer Wait
GattoDev (dev comms open)
okie then and does sapphire have discordjs included or do i have to import it myself?
Lioness100
Lioness100•3y ago
You'd have to import it yourself
GattoDev (dev comms open)
okayie then
GattoDev (dev comms open)
uhhhhh
Lioness100
Lioness100•3y ago
It's a GUI so you can manage your commands online
GattoDev (dev comms open)
oh okay'
GattoDev (dev comms open)
okayie
Alexandre
Alexandre•3y ago
Amazing
GattoDev (dev comms open)
i dont know which message to set as solved this or
Alexandre
Alexandre•3y ago
His message
GattoDev (dev comms open)
this...?
Alexandre
Alexandre•3y ago
No
GattoDev (dev comms open)
okay then, thanks for your helps!
Alexandre
Alexandre•3y ago
@Lioness100's message
GattoDev (dev comms open)
done it
const { Command } = require('@sapphire/framework');
class PingCommand extends Command {
constructor(context, options) {
super(context, { ...options });
}
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder.setName('ping').setDescription('Ping bot to see if it is alive')
);
}
}
module.exports = {
PingCommand
};
const { Command } = require('@sapphire/framework');
class PingCommand extends Command {
constructor(context, options) {
super(context, { ...options });
}
registerApplicationCommands(registry) {
registry.registerChatInputCommand((builder) =>
builder.setName('ping').setDescription('Ping bot to see if it is alive')
);
}
}
module.exports = {
PingCommand
};
hmm yes removes it without needing token adds* why am i using htis i should use the tool you gave me
Alexandre
Alexandre•3y ago
like that
client.application.commands.fetch('123456789012345678') // id of your command
.then( (command) => {
console.log(`Fetched command ${command.name}`)
// further delete it like so:
command.delete()
console.log(`Deleted command ${command.name}`)
}).catch(console.error);
client.application.commands.fetch('123456789012345678') // id of your command
.then( (command) => {
console.log(`Fetched command ${command.name}`)
// further delete it like so:
command.delete()
console.log(`Deleted command ${command.name}`)
}).catch(console.error);
GattoDev (dev comms open)
okay again. thanks for all your helps. i dont know how much to thank you 2 tbh god im making alot of text mistakes
Lioness100
Lioness100•3y ago
Lol np
Lioness100
Lioness100•3y ago
Btw you can just do client.application.commands.delete and skip the fetch middleman
GattoDev (dev comms open)
fetch just checks if the command exists right?
Alexandre
Alexandre•3y ago
@Lioness100 every commands are fetch on login ? it resolve it
Lioness100
Lioness100•3y ago
Yeah, and gives you an object representation of it Idk, but it doesn't have to be fetched as long as you have the ID
Alexandre
Alexandre•3y ago
@Lioness100 it's not fetch by default console.log(client.application.commands.cache); Collection(0) [Map] {}
GattoDev (dev comms open)
and.. is there a way to send a ephermal message when... a subcomand is r-ran?
Alexandre
Alexandre•3y ago
await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
GattoDev (dev comms open)
in... sapphireJs is this?
Lioness100
Lioness100•3y ago
it doesn't have to be fetched as long as you have the ID
Sapphire is just a framework that makes a few things easier in bot creation. Everything you do is still discord.js It doesn't change anything in discord.js
GattoDev (dev comms open)
is this correct...?
const { SapphireClient } = require('@sapphire/framework');
require('dotenv').config()


const client = new SapphireClient({ intents: ['GUILDS', 'GUILD_MESSAGES'] });


await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
client.login(process.env.token);
const { SapphireClient } = require('@sapphire/framework');
require('dotenv').config()


const client = new SapphireClient({ intents: ['GUILDS', 'GUILD_MESSAGES'] });


await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
client.login(process.env.token);
sorry if i am asking alot of questions im new to sapphirejs and discord.js....
Lioness100
Lioness100•3y ago
Have you read the guide on the website?
Alexandre
Alexandre•3y ago
interaction is undefined
Lioness100
Lioness100•3y ago
It will guide you through your first command
Spinel
Spinel•3y ago
<:_:746069730170896405> Sapphire guide results: Getting Started / Getting started with Sapphire
Lioness100
Lioness100•3y ago
I gtg, hope you get everything figured out 🙂
Alexandre
Alexandre•3y ago
here
Alexandre
Alexandre•3y ago
Sapphire Framework
Creating a basic slash command | Sapphire
This section covers the absolute minimum for setting up a slash command. We have an entire "Application Commands"
Alexandre
Alexandre•3y ago
if you want you can voc in a voice channel and i can help you
GattoDev (dev comms open)
iran is weird with discord voice channels
Alexandre
Alexandre•3y ago
const { Client } = require('discord.js');
const client = new Client({ intents: [] });

const commandId = 'commandId';
client.on('ready', async () => {
const command = client.application.commands.cache.get(commandId) ?? await client.application.commands.fetch(commandId);
command.delete().then(() => console.log(`Deleted command ${command.name}`)).catch(console.error);
client.destroy();
});

client.login('token');
const { Client } = require('discord.js');
const client = new Client({ intents: [] });

const commandId = 'commandId';
client.on('ready', async () => {
const command = client.application.commands.cache.get(commandId) ?? await client.application.commands.fetch(commandId);
command.delete().then(() => console.log(`Deleted command ${command.name}`)).catch(console.error);
client.destroy();
});

client.login('token');
GattoDev (dev comms open)
just gets stuck on "connecting"
Alexandre
Alexandre•3y ago
use ?? to use the second instruction if it is undefined or null maybe your discord, what did you use ? The electron app ?
GattoDev (dev comms open)
yea wait let me switch to my other net
Alexandre
Alexandre•3y ago
you can try website version
GattoDev (dev comms open)
done maybe i can join now #Coding 0? so.
Alexandre
Alexandre•3y ago
sorry for my bad english, im french
GattoDev (dev comms open)
holy crappo moly. i just closed steam and audio BLASTED
Alexandre
Alexandre•3y ago
??
GattoDev (dev comms open)
why does steam have its own device driver?????
Alexandre
Alexandre•3y ago
are u laggy ? what did you mean ?
GattoDev (dev comms open)
my pc defaulted the output device to the steam streaming audio device which was unplugged sorry i cant talk btw dont have a mic sadly wait ohhhh wait i figured it out dumb me
Favna
Favna•3y ago
@Lioness100 is "Her" btw
Alexandre
Alexandre•3y ago
@Lioness100 sorry
Krish
Krish•3y ago
thanks for this
Alexandre
Alexandre•3y ago
it just amazing
Lioness100
Lioness100•3y ago
@Favna can I pr a new tag for the delete a command question that recommends either 1. Using that website 2. Using <client.application | guild>.commands.delete and 3. Waiting for that BulkOverwrite pr?
Favna
Favna•3y ago
sure

Did you find this page helpful?