Register and Run Slash Commands (Discord.js v14)

  Рет қаралды 99,101

Under Ctrl

Under Ctrl

Жыл бұрын

Register and Run Slash Commands (Discord.js v14)
🌐 Important links:
Discord.js series playlist: • Discord.js v14 Tutorial
Discord.js official website: discord.js.org
Discord Commands Structure: discord.com/developers/docs/i... (Options & choices will be covered in the next video)
Patreon: / underctrl
Buy me a coffee (one-time donation): buymeacoffee.com/underctrl
🎵 Music Credits:
Track Name: "And So It Begins"
Music By: Artificial Music @ / artificial-music
Original upload HERE - / and-so-it-begins
Official "Artificial Music" KZbin Channel HERE - / smarttoaster
License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0) License.
Full License HERE - creativecommons.org/licenses/...
Music promoted by NCM / @chillcopyrightfreemusic

Пікірлер: 204
@UnderCtrl
@UnderCtrl Жыл бұрын
Source code: github.com/notunderctrl/discordjs-v14-series Discord server: discord.gg/T4faJeH84A
@Leafstuff
@Leafstuff 9 ай бұрын
hey i need help. at 5:49, when i try and run the node src/register-commands.js it comes up with registering slash commands... There was an error: DiscordAPIError[0]: 405: Method Not Allowed i followed you exactly but it isnt working and i cant find what the issue is.
@sharko_000
@sharko_000 8 ай бұрын
@@Leafstuff replace the applicationGuildCommand to applicationGuildCommands (yes you only need to put "s")
@spl1c3
@spl1c3 5 ай бұрын
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.
@UnderCtrl
@UnderCtrl 5 ай бұрын
Thanks! 🙏
@ralphwiggum1203
@ralphwiggum1203 Жыл бұрын
I love that you show how we can figure things out for ourselves like using console logs and documentations to find parameters
@satrajit
@satrajit 10 ай бұрын
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 :)
@MasculineFortitudeX
@MasculineFortitudeX Жыл бұрын
just got into nodejs heavily recently, thanks for showing how to set up nodemon -g it saves so much development time i believe instead of having to go back after every change to manually rerun code🤘
@vars8831
@vars8831 Жыл бұрын
Very underappreciated tutorial. Good job man and your voice is perfect for this kind of videos.
@UnderCtrl
@UnderCtrl Жыл бұрын
Much appreciated!
@Ender_Cafe_MDZ
@Ender_Cafe_MDZ Жыл бұрын
I'm a viewer from Thailand. Your video clips teach, understand, easy to practice. Keep making good video clips. 😀
@kortex_f-c_1817
@kortex_f-c_1817 Жыл бұрын
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.
@UnderCtrl
@UnderCtrl Жыл бұрын
Glad it helped!
@Arshlow
@Arshlow Жыл бұрын
Thank you so much for your videos, I'm learning both English and Discordjs
@abdielcuevas4281
@abdielcuevas4281 2 ай бұрын
In case you get the following error "DiscordAPIError[50001]: Missing Access", in the GUID_ID put the server id
@AjvarRelish
@AjvarRelish Ай бұрын
THANK YOU!!
@oscarthroedsson1410
@oscarthroedsson1410 7 ай бұрын
You videos is so much better then discords tutorials.. Keep it comming
@isseyyy69
@isseyyy69 Жыл бұрын
you are explaining very good!
@git-sujon
@git-sujon Жыл бұрын
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!
@BeelBellX
@BeelBellX Жыл бұрын
Thank you very much, it helped me a lot.
@brycemiller9604
@brycemiller9604 4 ай бұрын
For anyone who possible gets this error CODE: "DiscordAPIError[50035]: Invalid Form Body 0.name[APPLICATION_COMMAND_INVALID_NAME]: 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
@LordLukie
@LordLukie 2 ай бұрын
OH MY GOD THANK YOU SOOOO MUCH
@Krokodonarion
@Krokodonarion Ай бұрын
thx that saved alot of time
@andressaoliveirad
@andressaoliveirad 4 күн бұрын
THANK U
@MasculineFortitudeX
@MasculineFortitudeX Жыл бұрын
this is awesome ! thanks
@Skilllssue
@Skilllssue Жыл бұрын
Thank you! you recieved a subscriber
@aiwanano6507
@aiwanano6507 7 ай бұрын
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( Routes.applicationGuildCommands( 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.
@zombiepigmandude7759
@zombiepigmandude7759 6 ай бұрын
thank you you beautiful man
@Shrey_Yash
@Shrey_Yash 20 күн бұрын
Thank you so much internet stranger, may all the blessings be with you
@grimgaunt.
@grimgaunt. Жыл бұрын
Thank you~
@Pi_Maaster
@Pi_Maaster Жыл бұрын
you are the best
@DevNaN_
@DevNaN_ Ай бұрын
A little late for this, but what if I want it to be multi-server?
@automhate
@automhate Ай бұрын
For anyone having the error: 0.name[APPLICATION_COMMAND_INVALID_NAME]: Command name is invalid. make the name between the strings LOWERCASE! name: 'Hey' is NOT gonna work. Instead, try name: 'hey'
@OrangeRoot
@OrangeRoot 13 күн бұрын
Thx bro!
@the-name-is-mocha9570
@the-name-is-mocha9570 5 ай бұрын
Amazing video, although i have one problem. The code is exactly the same however an error pops up when executing node src/register-commands.js, It tells me: There was an error: DiscordAPIError[50041]: Invalid API version. Any way how to fix this?
@xanmal7042
@xanmal7042 Жыл бұрын
I get no log messages. I don't get an error. the program just runs then turns off..
@darksantaeu
@darksantaeu 10 ай бұрын
i have an error when running node src/register-commands.js . it says discord API Error[1002] . Help?
@SFDark
@SFDark 2 ай бұрын
When i attempt to turn on the bot after writing the register-commands file, the bot straight up ignores it. No console.log events appear, no texts, no warnings. It just tells me that the bot is online. What did I do wrong? Edit: nevermind, i figured it out. I just had to run node src/register-commands.js first before turning on the bot. After doing that, the commands appear and work.
@aveyan23
@aveyan23 5 ай бұрын
You forgot to add this thing 'npm i dotenv' , but overall 10/10
@UnderCtrl
@UnderCtrl 5 ай бұрын
This video is part of a series, and dotenv was covered in the video before this (part 1)
@alexaligator
@alexaligator 3 ай бұрын
hey ! i really apriciate that you making these type of videos there are awesome tutorials! but i have a question can u explain why we need to add AppID token amd guildID to applicationguildcommand? at least i can undertand why for REST you need token that i don't get it why you need App ID and Guild ID , like we already creating bot and there no need of AppID . Also its a nice feature that you can test some command before lunch to global but why i how to change guildID that could works on every server?
@HuyMusicYTC
@HuyMusicYTC 6 ай бұрын
There was an error: DiscordAPIError[50035]: Invalid Form Body 0.name[APPLICATION_COMMAND_INVALID_NAME]: Command name is invalid. I have that error pls help me
@pHaace
@pHaace 5 ай бұрын
i dont get my bot in the slash commands space but cant see why its not working
@thiagolore7045
@thiagolore7045 Жыл бұрын
how i make the slash commands appear in every server it is?
@DannyCheezits
@DannyCheezits 6 ай бұрын
any idea why each command gets registered twice indentically?
@user-tx2wb8dx5d
@user-tx2wb8dx5d 10 ай бұрын
what do i do when it says ReferenceError Route is not difined
@dapesaDVD
@dapesaDVD 8 ай бұрын
As the Discord.js documentation says: "it's not a very good idea to have a single file with a giant if/else if chain for commands. If you want to implement features into your bot and make your development process a lot less painful, you'll want to implement a command handler." This way works, but is not the best one.
@UnderCtrl
@UnderCtrl 8 ай бұрын
Agreed! This is just an approach for beginners. In later videos I have covered multiple command handlers that handle registration.
@Inactivebiiiiiiiiit
@Inactivebiiiiiiiiit Жыл бұрын
Great Video! But I have a question. I tried adding a new slash commands, but it doesn't seem like the code even recognizes that it's there. I've refreshed many times, but it still won't work. Is there a way you could help?
@UnderCtrl
@UnderCtrl Жыл бұрын
Hey. There’s a few reasons on why you might be getting that issue. My doubt is it’s probably your commands structure. Join my server discord.gg/T4faJeH84A and I’ll help you troubleshoot the problem.
@mr.riceking9710
@mr.riceking9710 Жыл бұрын
Noticing that your codeblock has far fewer whitespaces than mine.... I've been using TAB for indentation but is there a more formal way of doing this or should I continue with what I'm doing?
@UnderCtrl
@UnderCtrl Жыл бұрын
Yes, in your visual studio code settings you can change the “Tab size” to 2 which is what I use. Your seems to be 4
@mr.riceking9710
@mr.riceking9710 Жыл бұрын
@@UnderCtrl Thank you! Keep up the amazing work man, been enjoying learning about discord.js.
@highstar_
@highstar_ 11 ай бұрын
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"
@chickenmeatpizza
@chickenmeatpizza 5 ай бұрын
idrk the ans but there are some helpful ppl in the server of under ctrl so maybe join that ig
@EdgeFPS
@EdgeFPS Ай бұрын
same here..There is no error in the snippet..still in discord. the slash is not registering. DId you overcome the issue?
@infini667
@infini667 Ай бұрын
Why not place the command registration in the main bot file, so that the commands are registered as soon as it starts?
@UnderCtrl
@UnderCtrl Ай бұрын
You can do that as well, but I thought of having a separation between the two so I may explain things a little better. I cover command registration on startup later in the series using a command handler.
@infini667
@infini667 Ай бұрын
@@UnderCtrl Thanks! I was reading in the discord.js guide that it’s a good idea to put it in a separate file because Discord limits the number of times you can register commands daily. Now I’m trying to use SlashCommandBuilder() to create commands with options and permissions, but it’s giving me a body formatting error when registering the commands. I also read in the guide that you need to create a file for each command and do several other things... I think It's absurd for something that should be simple. I just watched your handler video... man, first of all, thank you for making these videos, and I think your method of doing things has a basis, but it adds too much complexity for something that is a simple registration and functionality of commands. I don't see the point in adding multiple files and folders. Bro, I have a bot made in Java (JDA) where the commands are registered with all options completed in literally 2 lines of code, and an event listener directs the actions to a command manager class. It's that simple. There must be a way to do this in a simpler way with JS.
@mollywater8715
@mollywater8715 6 ай бұрын
these videos are very helpful but its so frustrating that in only a year everything updates to where it keeps throwing errors
@misty5130
@misty5130 Ай бұрын
Hello! Thank you so much for these tutorials. Something I noticed is that every time I add commands to my bot, I have to kick and reinvite it for the new commands to show up. Is there a way to have them automatically appear without a kick/rejoin?
@UnderCtrl
@UnderCtrl Ай бұрын
Hey. So that's most likely a Discord caching issue with the desktop app. Instead of kicking the bot and re-inviting it, I suggest just refreshing your Discord using Ctrl + R (Cmd + R on mac) and you'll get updated commands.
@misty5130
@misty5130 Ай бұрын
@@UnderCtrl Thank you, I'll give it a shot!
@user-qk4yv5yk2j
@user-qk4yv5yk2j 6 ай бұрын
You can help me? I have a error. ReferenceError: procces is not defined
@weightliftingcalisthenics3931
@weightliftingcalisthenics3931 9 ай бұрын
@underctrl Its saying "there was an error: discordapierror [50035]: invalid form body name [application_command_invalid_name] command name is invalid... how to fix?
@kontorudaisuki6938
@kontorudaisuki6938 2 ай бұрын
Same here, do you happen to fix it already by any chance?
@moman6456
@moman6456 Жыл бұрын
hey bro ! fantastic vid, it really elps me out as im trying to learn coding, but i have a question, when i write the description: '....' it shows a problem and i cant figure it out, could u please help me?
@ashgaming3965
@ashgaming3965 8 ай бұрын
the ... means there is more text than it can show on the description section of the avatar. try removing the newlines.
@OPMayo_VR
@OPMayo_VR 11 ай бұрын
Whenever i try to do this it says my console log for the error then "DiscordAPIError [50035]: invalid body name[STRING_TYPE_REGEX]: String value did not match validation regex. How do i fix this? figured it out, i just had to take away the ! point... took me 3 hours to figure that out.
@kontorudaisuki6938
@kontorudaisuki6938 2 ай бұрын
May i know where you change it? cause I've been struggling with same problem and I don't know where to fix this
@Reedfender
@Reedfender 8 ай бұрын
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
@fishhairgel
@fishhairgel 5 ай бұрын
OMG I luv you! Was spending almost 2 hours rewriting, comparing code, all that!
@sparrowTTV
@sparrowTTV 11 ай бұрын
For those of you getting "TypeError: (intermediate value).setToken(...) is not a function".......................put a SEMICOLON after "const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)"
@hredd9299
@hredd9299 8 ай бұрын
I tried this but still keep getting an error
@Likeable_Emmec
@Likeable_Emmec 7 күн бұрын
My saviour!
@zaixyu
@zaixyu Жыл бұрын
i know this is kinda old but i cant seem to get my token to work, it says TypeError: (intermediate value).setToken(...) is not a function 😞
@immuchh
@immuchh 10 ай бұрын
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
@fingore7530
@fingore7530 Жыл бұрын
Hello, I was wondering if there was a way to have the GUILD_ID be set so that the bot can be accessible on any other server besides the test one you made, and I wasn't sure if this would be in a future video, so I am asking here now. I can be really bad at explaining things at times, so I hope you understand what I meant. Haha 😅
@fingore7530
@fingore7530 Жыл бұрын
@@skid-rv8tz No sadly
@HarshalGaikwadcheekunikku
@HarshalGaikwadcheekunikku 11 ай бұрын
It's pretty simple, in register-commands.js replace await rest.put( Routes.applicationGuildCommands(clientId, guildId), { body: commands }, ); and instead put await rest.put( Routes.applicationCommands(clientId), { body: commands }, );
@jryer1
@jryer1 Жыл бұрын
Can the index js send a slash command, even if there was no interaction initiated on the server? And will the Discord server run the slash command sent? I run windows, so my intent is to set up a daily schedule in the windows scheduler, that would run the js file at a given time everyday
@UnderCtrl
@UnderCtrl Жыл бұрын
If you want to send some message some time of the day, you can instead fetch the channel and send a regular message. You don't have to use slash command interactions for that. Interactions are only triggered when a user interacts in some way with your Discord bot.
@jryer1
@jryer1 Жыл бұрын
@@UnderCtrl Can the js fetch the channel and send a slash command? I have a particular slash command on a private channel that performs a function. Right now I end up doing that manually on the channel each day, but I want the js to do it for me instead.
@HarshalGaikwadcheekunikku
@HarshalGaikwadcheekunikku 11 ай бұрын
​@@jryer1 Yes, you can. If you want to find the channel by its id (get the id by right-clicking it in developer mode), then put this code (recommended if your bot is in multiple servers): channel = client.channels.cache.find(ch => ch.id === 'your-channel-id') If you instead want to find the channel by its name, enter this code (recommended if your bot is for one server): channel = client.channels.cache.find(ch => ch.name === 'your-channel-name') After this, you have to send the message using channel.send('This message was sent to its designated channel.') Here's how I would write your full code: // first, run npm install cron in your terminal // at the top of your file const cron = require('cron') // this next piece of code goes inside whatever client ready event you have, whether it is client.once(Events.ClientReady,...), client.once('ready',...), etc.) client.once('ready', (c) => { console.log(`${c.user.tag} is online`) // you may have something like this in your client ready event let scheduledMessage = new cron.CronJob('00 30 12 * * *', () => { // The format is seconds minutes hours, so 00 30 12 would send a message at 12:30 (please note this adjusts for your timezone) const channel = client.channels.cache.find(ch => ch.id === 'your-channel-id') // or channel = client.channels.cache.find(ch => ch.name === 'your-channel-name') // in the above line, if. you define your client as Discord.Client at the top of your code, replace "client" with Discord.Client channel.send('This message was sent at 12:30!'); }); scheduledMessage.start() }); And that should be all! If you have any follow-up questions, please reply to this comment. Sorry for the long reply, but hope this helped!
@ashgaming3965
@ashgaming3965 8 ай бұрын
@@jryer1 you could make a seperate file that does what the slas command does and then shedule the file to run eveyday using whatever you want
@ShlokKapadia
@ShlokKapadia Жыл бұрын
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.
@galimastermc3645
@galimastermc3645 Жыл бұрын
same help
@spirit8878
@spirit8878 Жыл бұрын
I had a error with the slash command: DiscordAPIError[20012]: You are not authorized to preform this action on this application.
@L33bear
@L33bear Жыл бұрын
your token is wrong
@weightliftingcalisthenics3931
@weightliftingcalisthenics3931 9 ай бұрын
@Under Ctrl At 5:03 what did you click to put GUILD_ID down? Pleae help.
@evozebra5958
@evozebra5958 8 ай бұрын
enter
@ik4k
@ik4k Ай бұрын
hey so when i try to run the commands or check on it like node register-commands.js it does not work and the was same before when I have try to run the bot same does not work until i use client.login(''); and I closed the .env (deleted) when I open a .env channel and use TOKEN = .... that doesn't work I hope you understand what I'm trying to explain
@ik4k
@ik4k Ай бұрын
@UnderCtr
@aqfeet_clashroyale
@aqfeet_clashroyale 11 ай бұрын
@UnderCtrl it says for me that setToken(...) is not a function. I copied your code from Github so that means its the same as your, please help
@Pshock13y
@Pshock13y 4 ай бұрын
I had the same issue, make sure that when defining `const rest` that there is a semicolon(;) at the end of the declaration
@kxhna
@kxhna 7 ай бұрын
When I try to run the register-commands.js file it says "DiscordAPIError[0]: 405: Method Not Allowed" How do i fix this?
@pcgg-kb4eg
@pcgg-kb4eg 7 ай бұрын
Same here
@stijn_gamet
@stijn_gamet 6 ай бұрын
applicationGuildCommands not applicationGuildCommand
@KaaNoFPS
@KaaNoFPS 5 ай бұрын
how do i get the design like you?
@TristanReeves1897
@TristanReeves1897 4 ай бұрын
My commands won't show up, someone help me out pls?
@roto2134
@roto2134 7 ай бұрын
how to remove a registered slash command ?
@Zolac36
@Zolac36 Жыл бұрын
thanks but I don't have handelcommands,handleevents folders :(
@UnderCtrl
@UnderCtrl Жыл бұрын
You don't need it for this video. We cover it later in the series.
@MetaIsRG4L
@MetaIsRG4L Жыл бұрын
@underctrl I get an error that says: There was an Error: DiscordAPIError[0]: 405: Method Not Allowed. Can someone help me?
@SKoRSA
@SKoRSA 11 ай бұрын
To resolve this error, you can try using a different username that does not contain "discord".
@weightliftingcalisthenics3931
@weightliftingcalisthenics3931 9 ай бұрын
​@@SKoRSAwhat do you mean by username, it's giving me this error now too?
@weightliftingcalisthenics3931
@weightliftingcalisthenics3931 9 ай бұрын
The require name?
@stijn_gamet
@stijn_gamet 6 ай бұрын
applicationGuildCommands not applicationGuildCommand
@fitzy121fitzgerald5
@fitzy121fitzgerald5 8 ай бұрын
hey i was working on this and when i hit the 5:56 minutes part i got discord is undefined cant find a solution to it?
@fitzy121fitzgerald5
@fitzy121fitzgerald5 8 ай бұрын
found the issues
@beezy-3505
@beezy-3505 3 ай бұрын
Hey in minute 5.56 i get an typeError .setToken isnot a function please help me solve it
@SlimeyHD
@SlimeyHD 2 ай бұрын
I got it too and adding a semicolon behind the line with the setToken function fixed it
@rainsmcacc
@rainsmcacc 10 ай бұрын
Thanks for the last video was really helpful! and this is by far the best video yet on how to make discord bots! so right now im coming across this error when i type in "node src/register-commands.js" Registering Slash Commands... There was an Error: DiscordAPIError[50035]: Invalid Form Body name[APPLICATION_COMMAND_INVALID_NAME]: Command name is invalid What should I do to fix it? (I tried looking it up i wasn't able to find my answer so I thought maybe you would know.
@UnderCtrl
@UnderCtrl 10 ай бұрын
One of your commands has an invalid name. Make sure it doesn’t have uppercase, spaces or any other special characters.
@kingananas2.0
@kingananas2.0 Жыл бұрын
The env stuff does'nt work for me. It only says that the Token is invalid, i've resetted it and added it to the file, but it still doesn't work.
@UnderCtrl
@UnderCtrl Жыл бұрын
Make sure .env is in the root level, not inside the src folder.
@kingananas2.0
@kingananas2.0 Жыл бұрын
@@UnderCtrl it is in the root level
@stryff
@stryff Жыл бұрын
@@UnderCtrl lmao been stumped on this ty
@robhopper5729
@robhopper5729 11 ай бұрын
when I run the command node src/register-commands.js it doesn't do anything. No errors, no / commands on my server. nothing. Just keeps running like nothing happened.
@UnderCtrl
@UnderCtrl 11 ай бұрын
Try restarting the terminal and try again. If the issue still persists please join my Discord and share your issue there: discord.underctrl.io
@usernamesareuseless262
@usernamesareuseless262 8 ай бұрын
Idk if you still have this problem. But you most likely forgot to add a (); at the end of the async function.
@lzimport
@lzimport Жыл бұрын
bro,you're a god. did you have any udemy course? or any course besides youtube? i would like to pay damm
@UnderCtrl
@UnderCtrl Жыл бұрын
Thank you so much for the positive comment! 😊 I don’t have any courses yet but I am planning to create one which covers the Discord.js library.
@lzimport
@lzimport Жыл бұрын
@@UnderCtrl just have a quick question,how to you keep the bot online withouth need the pc?
@UnderCtrl
@UnderCtrl Жыл бұрын
You have to host it on a server. You’d usually rent a server for that
@YourLocalPeanutButterEnjoyer
@YourLocalPeanutButterEnjoyer 4 ай бұрын
every time i run .setToken, i get given an error, and not processed thru console.log. im using discord.js version 14.14.1
@BANGPOWBANGPOWPOW
@BANGPOWBANGPOWPOW 19 күн бұрын
If the error is something like: "setToken is not a function" then add the semi colon to the end of it. (I know I'm late.)
@Trfcyfchfc
@Trfcyfchfc 9 күн бұрын
@@BANGPOWBANGPOWPOWThank you so much! I was stuck here for like 10 minutes.
@SreekalaS-cj9bs
@SreekalaS-cj9bs Жыл бұрын
broo i prmblmm my slash code is registering but after that insted of registerd successfully There was an error: Error: Expected token to be set for this request, but none was present this is showing wt is prob
@trrzy8394
@trrzy8394 4 ай бұрын
I have that same problem, havent figured it out yet
@ilovelampadaire
@ilovelampadaire Ай бұрын
You need to be in the folder before the src folder and then, do: node src/register-commands.js
@gta_ishan
@gta_ishan 18 күн бұрын
Hello i tried the .env but idk it just throws error of invalid token
@KaidenAngle
@KaidenAngle 6 күн бұрын
save all your files by going through every file and hitting ctrl + s
@xxlilnovaxx
@xxlilnovaxx Жыл бұрын
Why do i keep getting this? node:internal/modules/cjs/loader:1093 throw err; ^ Error: Cannot find module 'C:\Users\justd\Downloads\NovaBotBeta\src egister-commands.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15) at Module._load (node:internal/modules/cjs/loader:934:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v19.8.1
@RoganShorts2715
@RoganShorts2715 Жыл бұрын
dont type nodemon just type node src/the name of your file. this worked for me
@xxlilnovaxx
@xxlilnovaxx Жыл бұрын
@@RoganShorts2715 ok ill try it, thank you
@j0ppi
@j0ppi Жыл бұрын
for me everything work, but when i try to make a second command, it's doesn't work :/ 9:24
@tariqplays5826
@tariqplays5826 3 күн бұрын
same, the application doesn't respond and throws an unknown interaction error
@Gfragakhs
@Gfragakhs 2 ай бұрын
i tried everything but i couldnt get the src/register-command.js to respond i have the exactly same code as you and it doesnt respond. i need a bit help
@BANGPOWBANGPOWPOW
@BANGPOWBANGPOWPOW 19 күн бұрын
Your .env file might not be where it should or something of the sorts, where `process.env.thingy` is used, try using the bare "strings!"
@spellq8367
@spellq8367 Жыл бұрын
Nice video, but i have problem DiscordAPIError[50035]: Invalid Form Body name[APPLICATION_COMMAND_INVALID_NAME]: Command name is invalid. Can you help me solve this?
@UnderCtrl
@UnderCtrl Жыл бұрын
One of the commands you’re registering has an invalid name. Make sure it doesn’t have any space, only letters and make sure it’s all in lowercase. If all your command names are fine then check your options inside your commands to follow the same pattern. Options can however use “-“ in their names.
@spellq8367
@spellq8367 Жыл бұрын
@@UnderCtrl You are the only one who really helped me with writing the bot, thanks so much !
@Zaheed_And_Jordyn
@Zaheed_And_Jordyn 11 ай бұрын
​@@UnderCtrlWhat do you mean by that?
@Nixthefurry
@Nixthefurry 4 ай бұрын
hey @underctrl im having the problem of it having too many commands that i dont want
@midwesternlassalle
@midwesternlassalle Жыл бұрын
Bruh, it keeps saying settoken is not a function. Y'know anyway to fix this? i've been scratching my head for the past 2 hours
@midwesternlassalle
@midwesternlassalle Жыл бұрын
fixed it following me sending this, probably spoke too soon
@bezarwashere
@bezarwashere 7 ай бұрын
Im having a problem it says: There was an error: DiscordAPIError[0]: 405: Method Not Allowed
@stijn_gamet
@stijn_gamet 6 ай бұрын
applicationGuildCommands not applicationGuildCommand
@jacklondon2663
@jacklondon2663 5 ай бұрын
hey, can other users use these commands as well? i mean does bot reply them too?
@wetn
@wetn 4 ай бұрын
Yes
@gooseman4776
@gooseman4776 5 ай бұрын
How can i fix it?: There was an error: DiscordAPIError[0]: 405: Method Not Allowed
@LIL_13EN
@LIL_13EN 4 ай бұрын
applicationGuildCommands, I forget add the 's' at the tail , now is working
@zynphxz1694
@zynphxz1694 3 ай бұрын
@@LIL_13EN you saved me bro
@splashyreacts
@splashyreacts Жыл бұрын
how do i make the bot respond with the interaction author username?
@UnderCtrl
@UnderCtrl Жыл бұрын
interaction.reply(`Hey there ${interaction.member.username}!`)
@splashyreacts
@splashyreacts Жыл бұрын
@@UnderCtrl thanks! How do I define the username? Its responding Hey there undefined
@XxprogamerezcerezxX
@XxprogamerezcerezxX 11 ай бұрын
it sends me an empty message box
@tennlam4356
@tennlam4356 6 ай бұрын
I get the following error: An error has occured: DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. Does anyone know how to fix this?
@robotmercenary8844
@robotmercenary8844 6 ай бұрын
After Troubleshooting for a moment, My issue was the env file was not saved. Make sure you save the env file so that the functions are actually retrievable.
@darkzy6950
@darkzy6950 12 күн бұрын
@@robotmercenary8844DUDE I LOVE YOU
@darkzy6950
@darkzy6950 12 күн бұрын
@@robotmercenary8844saved me so much
@lukegilson2917
@lukegilson2917 Жыл бұрын
it keeps saying invalid token provided when I know its the right token
@lukegilson2917
@lukegilson2917 Жыл бұрын
fixed
@justecho5760
@justecho5760 4 ай бұрын
I dunno why, but it didn't work for me :(
@eonharper1824
@eonharper1824 Жыл бұрын
When i run this it says MODULE_NOT_FOUND Could i please have help thanks
@UnderCtrl
@UnderCtrl Жыл бұрын
Quite a few reasons why that could happen. Please join my Discord for help: discord.underctrl.io
@eonharper1824
@eonharper1824 Жыл бұрын
@@UnderCtrl alright thank you
@Zolac36
@Zolac36 Жыл бұрын
how to get the src file???
@UnderCtrl
@UnderCtrl Жыл бұрын
The src folder is what we created in the first video. It's not important if you already have an existing project. You can just create all your files and folders in your current directory. If you do choose a src folder make sure to change "main" in package.json to "src/index.js"
@Zerokopas
@Zerokopas Жыл бұрын
I have error method not allowed
@ralphwiggum1203
@ralphwiggum1203 Жыл бұрын
im getting this too ill update if i find a fix
@lukegilson2917
@lukegilson2917 Жыл бұрын
also the .settoken isn't a function no more.
@_MAGMI
@_MAGMI Жыл бұрын
why do we need the guild id ?
@UnderCtrl
@UnderCtrl Жыл бұрын
To register commands to that specific server only. Global commands can take time to register
@Boxed-matt
@Boxed-matt 2 ай бұрын
Hey where do you find the guild Id ??
@LogoSystemCG
@LogoSystemCG Ай бұрын
this is your discord server ID
@theemeraldend4302
@theemeraldend4302 9 күн бұрын
I made this mistake too. You need to right click the discord server name. not left click. It looks like Two seperate menus but they look increadibly similar
@perfect.999
@perfect.999 Ай бұрын
i wrote a slash command with ur tutorial, the command itself works properly however i can use this command once and my bot crashes and i have to restart my bot, any help? @UnderCtrl
@ImAlxer
@ImAlxer 2 ай бұрын
undefined value in guild id and user id wtf
@Himanshupatel-ij3zq
@Himanshupatel-ij3zq 8 ай бұрын
I am getting multiple instance for single input user input: Hi Bot Output: Hey Hey Hey
@UnderCtrl
@UnderCtrl 8 ай бұрын
That is probably because you have multiple terminals open
@Himanshupatel-ij3zq
@Himanshupatel-ij3zq 8 ай бұрын
@@UnderCtrl thanks I got solution from your discord.
@Bluei2h
@Bluei2h Жыл бұрын
Everything is going well, but i am experiencing a problem (async() => { ^ TypeError: (intermediate value).setToken(...) is not a function at Object. (C:\Users\294ad\Captain's Utilities\src egister-commands.js:13:1) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47
@williamdragon1023
@williamdragon1023 Жыл бұрын
Use client.application.commands.set(commandsArray);
@hamm3rman199
@hamm3rman199 Жыл бұрын
I experienced the similar problem, but I figured out how to fix it: const rest = new REST({ version : '10'}).setToken(process.env.TOKEN); You must have corrected it or something by now.
@mariesaoconnell7281
@mariesaoconnell7281 Жыл бұрын
This happened to me, I missed the set of parentheses at the very end
@kanlin2501
@kanlin2501 10 ай бұрын
spent 30 min on this error, the semi colon is required when defining rest. this works: const rest = new REST({ version: '10' }).setToken(process.env.TOKEN); this doesnt: const rest = new REST({ version: '10' }).setToken(process.env.TOKEN)
@hackerboomm.official
@hackerboomm.official 10 ай бұрын
I tried this code but there is an error like this: 🔴 Error is: DiscordAPIError[50035]: Invalid Form Body Can someone help!
@hackerboomm.official
@hackerboomm.official 10 ай бұрын
I solved the problem anyways
@immuchh
@immuchh 10 ай бұрын
please help me with that as i have the same problem
@twojmruczus
@twojmruczus Жыл бұрын
um.. ;-; that's not exactly working
@bendeguzbenkovics903
@bendeguzbenkovics903 2 ай бұрын
Hello! I got an error: DiscordAPIError[50035]: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "1184131001585250374, 1184132196659908618" is not snowflake. guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
@troll3917
@troll3917 5 ай бұрын
Hey, great video! Although, I am facing a problem. P.S - RMP_ID is my Bot user ID. My code is running, however, I don't see the applications for the bot, this is my code: require('dotenv').config(); const { REST, Routes } = require('discord.js') const cmds = [ { name: 'Test', description: 'Replies with RMP online' } ]; const rest = new REST({ version: '10'}).setToken(process.env.TOKEN); (async () =>{ try{ console.log('Registering slash commands...'); await rest.put( Routes.applicationGuildCommands(process.env.RMP_ID, process.env.GUILD_ID) ); console.log('Slash commands prompts registered.'); }catch (error){ console.log(`There was an error ${error}`); } })(); Any help is appreciated, thanks!
@thespacemanfil4921
@thespacemanfil4921 11 ай бұрын
4:32 Replace your fire alarm batteries bro
@UnderCtrl
@UnderCtrl 11 ай бұрын
LOL! Those were cars honking if I remember correctly. At that time I didn't bother doing a retake on them xD
@meowmeowfrfr
@meowmeowfrfr 11 ай бұрын
Hey I'm getting: TypeError: (intermediate value).setToken(...) is not a function. What does this mean? It doesn't let me run any slash commands:(
@immuchh
@immuchh 10 ай бұрын
replace the similar code with this const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
@hredd9299
@hredd9299 8 ай бұрын
@@immuchh I tried this yet still keep getting the same error any tips?
@immuchh
@immuchh 8 ай бұрын
@@hredd9299 ^
@jacobymryoutube
@jacobymryoutube 28 күн бұрын
Prob very late, but add a semicolon at the end of the line of code (with the .setToken part).
Slash Command Options and Choices (Discord.js v14)
6:19
Under Ctrl
Рет қаралды 55 М.
How to make a Discord Bot for Beginners (Discord.js v14)
27:29
Under Ctrl
Рет қаралды 309 М.
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 46 МЛН
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 3,8 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 98 МЛН
Making an Annoying Discord Feature even Worse
7:03
No Text To Speech
Рет қаралды 395 М.
How To Make An Advanced AI Discord Bot Withotu Coding V2
3:09
[NEW] Slash Commands in Less than 10 Minutes Using Discord.PY
5:55
Building a Discord Bot in Python (2024) Episode Four: Cogs
10:20
Paradoxial
Рет қаралды 1,2 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 77 М.
I made a Discord Bot that says Choo Choo
33:15
The Coding Train
Рет қаралды 39 М.
How The Web Works - The Big Picture
12:25
Academind
Рет қаралды 503 М.
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 46 МЛН