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
65 Replies
Alexandre
Alexandre•2y ago
Use discordjs like that
Rando
Rando•2y ago
import discordjs then remove it...?
Alexandre
Alexandre•2y ago
Alexandre
Alexandre•2y ago
With sapphire you can't
Rando
Rando•2y ago
can you remove only 1 slash command?
Alexandre
Alexandre•2y ago
When you use body: [], you remove the all slash command I think you can, I power on my computer Wait
Rando
Rando•2y ago
okie then and does sapphire have discordjs included or do i have to import it myself?
Lioness100
Lioness100•2y ago
You'd have to import it yourself
Rando
Rando•2y ago
okayie then
Solution
Lioness100
Lioness100•2y ago
Slash Commands GUI
Graphical User Interface to explore and edit your bot's slash commands!
Rando
Rando•2y ago
uhhhhh
Lioness100
Lioness100•2y ago
It's a GUI so you can manage your commands online
Rando
Rando•2y ago
oh okay'
Alexandre
Alexandre•2y ago
No, import it yourself
Rando
Rando•2y ago
okayie
Alexandre
Alexandre•2y ago
Amazing
Rando
Rando•2y ago
i dont know which message to set as solved this or
Alexandre
Alexandre•2y ago
His message
Rando
Rando•2y ago
this...?
Alexandre
Alexandre•2y ago
No
Rando
Rando•2y ago
okay then, thanks for your helps!
Alexandre
Alexandre•2y ago
@Lioness100's message
Rando
Rando•2y ago
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•2y ago
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Alexandre
Alexandre•2y 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);
Rando
Rando•2y ago
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•2y ago
Lol np
Lioness100
Lioness100•2y ago
Btw you can just do client.application.commands.delete and skip the fetch middleman
Rando
Rando•2y ago
fetch just checks if the command exists right?
Alexandre
Alexandre•2y ago
@Lioness100 every commands are fetch on login ? it resolve it
Lioness100
Lioness100•2y 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•2y ago
@Lioness100 it's not fetch by default console.log(client.application.commands.cache); Collection(0) [Map] {}
Rando
Rando•2y ago
and.. is there a way to send a ephermal message when... a subcomand is r-ran?
Alexandre
Alexandre•2y ago
await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
await interaction.reply({ content: 'Secret Pong!', ephemeral: true });
Rando
Rando•2y ago
in... sapphireJs is this?
Lioness100
Lioness100•2y 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
Rando
Rando•2y ago
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•2y ago
Have you read the guide on the website?
Alexandre
Alexandre•2y ago
interaction is undefined
Lioness100
Lioness100•2y ago
It will guide you through your first command
Spinel
Spinel•2y ago
<:_:746069730170896405> Sapphire guide results: Getting Started / Getting started with Sapphire
Lioness100
Lioness100•2y ago
I gtg, hope you get everything figured out 🙂
Alexandre
Alexandre•2y ago
here
Alexandre
Alexandre•2y 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•2y ago
if you want you can voc in a voice channel and i can help you
Rando
Rando•2y ago
iran is weird with discord voice channels
Alexandre
Alexandre•2y 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');
Rando
Rando•2y ago
just gets stuck on "connecting"
Alexandre
Alexandre•2y ago
use ?? to use the second instruction if it is undefined or null maybe your discord, what did you use ? The electron app ?
Rando
Rando•2y ago
yea wait let me switch to my other net
Alexandre
Alexandre•2y ago
you can try website version
Rando
Rando•2y ago
done maybe i can join now #Coding 0? so.
Alexandre
Alexandre•2y ago
sorry for my bad english, im french
Rando
Rando•2y ago
holy crappo moly. i just closed steam and audio BLASTED
Alexandre
Alexandre•2y ago
??
Rando
Rando•2y ago
why does steam have its own device driver?????
Alexandre
Alexandre•2y ago
are u laggy ? what did you mean ?
Rando
Rando•2y ago
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•2y ago
@Lioness100 is "Her" btw
Alexandre
Alexandre•2y ago
@Lioness100 sorry
Krish
Krish•2y ago
thanks for this
Alexandre
Alexandre•2y ago
it just amazing
Lioness100
Lioness100•2y 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•2y ago
sure