install node.js then when ur in your bot folder open the console in the bot folder location then run in the console npm install discord.js and it will download the reference to run your bot
@@CapyGamess WAIT HOW DOES IT WORK IN 2020?? I did everything and when I went to authorize it said that I needed a code grant... edit: I fixed that part, but now it says that I forgot the redirect.uri in request.
Some advice for everyone struggling: Don't give up. Read through the youtube comments. Be patient. You'll find the answer eventually. It's all worth it in the end!
You could also ask a question first in case it isn’t there and try to figure it out while people respond that way you help other people who have the same issue in the future as they will not have to search the whole comments section just to find one question
Also, if you are struggling, use: const Discord = require("discord.js"); const client = new Discord.Client(); client.on('ready', () => { console.log('This bot is online!'); }) client.login("Put your token here");
me spending 4 hours trying to get this to work then going to sleep to try again tomorrow. then in the morning i realize i didn't have something capitalized.
the zeddman node . Doesn’t work. Neither do any of the other variations. I checked multiple times and it’s exactly the same as how he did it so there must be some other way to get it to work
No, you see, discord bots are different from normal bots, discord bots do actions that are like play music, sending images without a person having to do all of that, normal bots are assigned to do one thing.
Yo, all guys who have problem that "node run index.js fails" instead of doing that from" /desktop/discord bot" do "/desktop/discord bot/node modules" and then type node index.js, This worked perfectly for me!
THANK YOU SO FREAKING MUCH! I've been struggling with tutorials for 4 FREAKING HOURS and yours was the easiest to understand! I only had to pause once!
Honestly im stupid, I had errors with "node ." And it was because my index.js file was inside the "node_modules" sooooo, if ur having a problem like me, theres a quick tip :\
GUYS! THIS HELPED FOR ME: if at the top it says const Client = Discord.client then change all of the "bot"s to "client"s. for example: Client.login(token) instead of typing in node . try typing in "node node_modules" this worked for me and i hope it helps you :)
I didn't expect this to be hard because I saw many of my friends made a bunch of bots for their server and now, I am crying. Anyway, thanks for showing us to create a bot CodeLyon!
If you're having trouble at the "node ." part. Here's how to fix. You need to save your file, exit the programs: Node and Command Bar Reload Node, and it works. Reply if u have issues.
(node:6900) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. at WebSocketConnection. (C:\Users\USER\Desktop\BOT ode_modules\discord.js\src\client\ClientManager.js:48:41) at Object.onceWrapper (events.js:313:26) at WebSocketConnection.emit (events.js:223:5) at WebSocketConnection.onClose (C:\Users\USER\Desktop\BOT ode_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10) at WebSocket.onClose (C:\Users\USER\Desktop\BOT ode_modules\ws\lib\event-target.js:124:16) at WebSocket.emit (events.js:223:5) at WebSocket.emitClose (C:\Users\USER\Desktop\BOT ode_modules\ws\lib\websocket.js:191:10) at TLSSocket.socketOnClose (C:\Users\USER\Desktop\BOT ode_modules\ws\lib\websocket.js:850:15) at TLSSocket.emit (events.js:228:7) at net.js:664:12 (node:6900) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:6900) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@@Jo_Krystelle if you have onedrive on your computer you have to first type 'cd onedrive' and then you should be able to continue with the video with 'cd desktop'
Hey dude, this video was very helpful. Thank you, this genuinely helped me as a beginner. Recently I've been studying geometry, and I got the chance to take a good intro to the basics on how to implement logic into equations. Since I recently got into that, I don't exactly know what it's called, but either way, I really wanted to take the time to thank you for the tutorial. I found this very helpful.
Okay, so a lot of people are having problems with "node ." If it says that it isnt a valid command, that most likely means that you dont have node installed, or that it isnt in your path. If you are Windows, do the following: Open Advanced System Settings (You can search for it by pressing the Windows key) Then click on "Environment Variables" and find the "Path" variable in the top list Select it and click "Edit" and then "New" in the window that appears Enter the install location of node (Likely C:\Program Files odejs) then click done. Node should then be recognized as a valid command.
I tried this, it still won't accept when I reset the studio, I have also spell checked and everything was correct from the video. What do I need to do to get it working?
oh nevermind i trashed it, and opened it again, but it still says "The term 'node' is not recognized as the game of a cmdlet, function, script file, or operable program..."
For anyone having trouble with "Cannot find the specified path" for the cd Desktop command, It took a while but I found a solution. -First Right click CMD Prompt and go to the folder location, Right click +Copy and Paste a shortcut to desktop OR you can alternatively just Pin it to the start menu. - You're going to want to Right Click and go to properties, Look where it says "Start in: " and make sure the location is C:\Users\yourusername (Initially mine was stuck in windows\system32 and it was unable to locate files because they were not in that folder.) - NEXT Open file explorer and navigate to c:\users\yourusername . Search for the folder that says Desktop and right click >> Proporties. Check the URL where it says Location. Some computers will list the location as "C:\users\yourusername\One Drive - If your desktop has OneDrive as the location, Open up the CMD, make sure it's on the c:\users\yourusername and type " cd onedrive " - You should now be in c:\users\yourusername\onedrive NEXT you need to type "cd desktop" -This should get you to the desktop folder where you can then enter the Discord bot folder and continue with the video perfectly. Hope that helps!
If it doesn't work do this : 1. Find the nodejs folder; it will be where you installed it. Copy the path. Open Control Panel > User Accounts > User Accounts > Change my environment variables (in the list on the left) > New... (User variables for ) > name it anything you want > paste the path > Press OK > Restart Visual Studio Code (Don't forget to save) > open a new terminal (make sure the shell is powershell) > run node .
you are very good at explaining i have never coded bots before but know how to code html etc. and was lost when i wanted to code bots but know i am king of bots, much love
The problem might be, (And I’ve seen a lot of people mess up on this) that you copied the token of your application. Do not copy the token of your Application. Go to Bot and copy THAT token.
random guy on the internet I love you, I just spent 20 mins trying to figure out why my bot was not working and then I went back and looked and I copied the wrong token, thanks a lot, I appreciate it
Just some issues I came across so no one else makes the same mistakes. #1, do not close the command prompt until you have finished the video. 2:30 'Visual Studio' and 'Visual Studio Code' are two different things (I believe). Make sure you have 'Visual Studio Code.' 3:36 This is where I first messed up because the letters are small. Make sure to type in 'npm init', with an M, not 'npn init.' Node Issue: In your command prompt, after c:\users\yourname\desktop\foldername> put (space)"node"(space)"." Will be editing this if I find anything else.
Hey uhm im at the part of where u say HELLO and its meant to say HELLO FRIEND! u see ive tried 3 times and it aint workin and i closed command promt as soon as it wasnt needed anymore-
If anyone still is having issues with the node . command, make sure to run the node.js installer and make sure to have it instal linto your path. Once that is done, restart ALL VS Code instances (make sure u save) and try again
Ya know bro, I may not be a pro at building Discord bots yet, but this video taught me something that I should have learned a long time ago--the difference between JavaScript and Node.JS--one is run in the browser, ONLY in the browser, and the other can be run on a PC!!! THANK YOU!!!!!!!!!
at Module._compile (internal/modules/cjs/loader.js:1072:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module._load (internal/modules/cjs/loader.js:778:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { [Symbol(code)]: 'CLIENT_MISSING_INTENTS'
You can instead just degrade discord.js version by typing this into shell: npm i discord.js@12.5.3 The latest discord.js version doesn't function very good so I use v12 - no complicated script.
@@-klol120-9 Sorry But I Am Not Getting You. If You Have Doubts In This Old Video, Then You Can See @CodeLyon's Latest Coding Video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-j_sD9udZnCk.html . It Is A 2020 Bot Coding Video
Why is it soo hard Error: Cannot find module 'C:\Users\Admin' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15) at Function.Module._load (internal/modules/cjs/loader.js:840:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: []
@@isaacandthebois5427 I looked at it and it also said that files must be placed C://User// (And your main account that you are using, for me it was Admin, but for you its probleably something else) Then I deleted these other files on my desktop.
last part when i type "node . + enter" it doesnt show anything it just says try the new cross-platform powershell and idk what to do next. please help asap :(
If you are having problems with "node ." 1. Go to Discord Dev Portal 2. Go to BOT AND NOT GENERAL INFO 3. On the bot tab you can see another token that actually says token. Copy that one and paste that one instead! 4. Save and try again :)
if i write "node ." then it writes: ReferenceError: requeire is not defined at Object. (C:\Users\peti0\Desktop\Discord And if i write "node run index.js" then it writes: Error: Cannot find module 'C:\Users\peti0\Desktop\Discord Bot un' i know this is a 1 year old video but soemone pls help and also saving doesnt helped anything update: i got it to work...i see some people still asking question like a week ago or days ago cuz this is the best tutorial for this that you can find so im going to tell how i did it 1. check your grammar - i literally wrote down "requiere" so pls check that 2. regenerate the token no matter what - and paste in the good one 3. save - go to the top left corner press file then save then close the visual studio then reopen it then try the node . or node run index.js and if thats not working then i dont know whats the error im sorry but if i helped then pls leave a like or just comment to me that it works now
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
at 14:30 when i type node ., it dont say online ... the sentence just repeats it self why is that ?.. wait now it says Error cannot find module 'discord'
My bot : Doesn't work CodeLyon : Use node run index.js instead ! My bot : Still doesn't work People : Save ! My bot : Still doesn't work Me : scrolls in the comments to see if someone got the same error message as me Also me : realizes that nobody got the same error message as me Still me : bruh
Guys, I know a lot of you are having problems with the "node ." thing. I'm going to be straightforward and help you guys. Visual Studio Code 1. Go to File in the upper left corner and click it 2. Press Save 3. Exit out of Visual Studio Code (by pressing the "x" in the upper right corner) 4. Then, open it again -- you should see what was there before if you saved it 5. Open the terminal by using pressing ctrl+` 6. Finally, type in "node ." It should work and say "This bot is online!", just like it did for me. Hope this helps you guys. :)
@@lianne4638 if node . isn't working, maybe you should check have you saved the file, or maybe your file name isn't the proper one, make sure is it 'index.js' or 'main.js' that's needed, and try to change it. I don't know more.
@@ans5607 Well, its not copying its more like, "In memory of pokecord". And hey, Ion want no money. Its just temporary until they consider getting pokecord back.
when i run node it’s telling me incorrect login details edit: I fixed it, i was using the wrong token. Make sure you use the bot token. and save it(ctrl + s) before you run “node .”
When I put node . It says “The term ‘node’ is not recognized as the name of a cmdlet, function, script file, or operable program. check the spelling of the name, or if a path was included verify that the path is correct and try again”.
3:41 when i try to space after npm init it shows me node is not recognized as internal or external command operable programme or batch file , now what can i do , pls someone help me.