Register and Run Slash Commands (Discord.js v14)

preview_player
Показать описание

🌐 Important links:

🎵 Music Credits:
Track Name: "And So It Begins"
License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0) License.
Рекомендации по теме
Комментарии
Автор

Hey Under Ctrl. The odds of you seeing this are pretty low, but I want to say these videos have been helping immensely. Don’t ever stop what you do, man.

splc
Автор

By far the most useful video I could find about slash commands, extra props for actually writing the code live and not just dumping a bunch of pre-written code. Thank you for the very clear video :)

satrajit
Автор

I love that you show how we can figure things out for ourselves like using console logs and documentations to find parameters

ralphwiggum
Автор

If your code for around 5:34 is not running (like it's not printing anything, just ignoring), make sure you add a (); at the end in order to invoke the function.

Problem (console):
Node.js v18.15.0
PS C:\Users\W\EconomyBot> node src/register-commands.js
PS C:\Users\W\EconomyBot>

Example:
(async () => {
try {
console.log("Registering slash commands...");
await rest.put(

process.env.CLIENT_ID,
process.env.GUILD_ID
),
{ body: commands }
);
console.log("Slash commands registered.");
} catch (error) {
console.log(`Error: ${error}`);
}
})();

The (); at the last line invokes the entire function and makes it run.

aiwanano
Автор

Very underappreciated tutorial. Good job man and your voice is perfect for this kind of videos.

vars
Автор

Thank you for creating this video! I was looking for the way to add slash Commands, but other guides didn't help. After watching this video all works successfully.

kortex_f-c_
Автор

Amazing videos. Even after following the tutorial I’m still messing up, resulting in me researching and looking for my mistake which I think is a great way to learn although frustrating.

maltyhopperbrewing
Автор

Thank you so much for your videos, I'm learning both English and Discordjs

Arshlow
Автор

I'm a viewer from Thailand. Your video clips teach, understand, easy to practice. Keep making good video clips. 😀

Ender_Cafe_MDZ
Автор

In case you get the following error "DiscordAPIError[50001]: Missing Access", in the GUID_ID put the server id

abdielcuevas
Автор

Hello there! I am thoroughly enjoying the content that you produce. Your videos are of high quality and I have just subscribed to your channel. I kindly request that you consider making some videos on how to customize an OpenAI bot. Thank you!

git-sujon
Автор

i did everything correctly and rewatched this multiple times, but the commands dont work
there are no errors, but when i use the slash command in the server, it says "the application did not respond"

highstar_
Автор

For anyone who possible gets this error CODE: "DiscordAPIError[50035]: Invalid Form Body
Command name is invalid"

your command names have to be all lowercase. literally spent 45 minutes trying to figure this out. Hope it saves someone some time

brycemiller
Автор

You videos is so much better then discords tutorials.. Keep it comming

oscarthroedsson
Автор

A little late for this, but what if I want it to be multi-server?

BloxedZR
Автор

@underctrl Its saying "there was an error: discordapierror [50035]: invalid form body name command name is invalid... how to fix?

weightliftingcalisthenics
Автор

I was getting error:
Error at: DiscordAPIError[50035]: Invalid Form Body
0.name[STRING_TYPE_REGEX]: String value did not match validation regex.

Resolved by deleting {version: '10'} in line 11

Reedfender
Автор

How can we delete the registered commands?
I made some commands for test and now I cannot remove them from the discord command menu,
Please help.

ShlokKapadia
Автор

@underctrl I get an error that says: There was an Error: DiscordAPIError[0]: 405: Method Not Allowed. Can someone help me?

MetaIsRGL
Автор

gives me this error: DiscordAPIError[20012]: You are not authorized to perform this action on this application every time i try the node src/register-command.js command

smartbox