Coding Your Own Discord Bot - Discord.js - Setting Up Your Bot - *OLD*

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


-----------------------------------------------------------------------------------------------------------
If you liked the video then please respond with a like and a subscribe to show your support for the channel and I'll repay you by creating more tutorials like this one :)
Рекомендации по теме
Комментарии
Автор

I know nothing about coding and I was still able to understand this without too many difficulties. Thank you!!

casper
Автор

SyntaxError: Unexpected token )
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile
at Object.Module._extensions..js
at Module.load
at tryModuleLoad
at Function.Module._load
at Function.Module.runMain
at startup
PS

iiDk_
Автор

This is definitely one of the best and clearest Discord Bot Tutorials I've seen. Good job!

oscarhoodsmith
Автор

thanks man, i first did this a few months ago and it didnt work but now that i unsterstand code more i figured it out and it worked cant wait to watvh the rest of the series!

jamiekearns
Автор

[ATTENTION] if you had an issue with npm init where the power shell/cmd in visual studio cod would say "'npm' is not recognized as an internal or external command" here's the solution!
steps:
1. navigate to the discord bot folder designated on visual studio code via the file explorer
2. create a text file within that file that say "start cmd.exe"
3. save the .txt file as cmd.bat (make sure to change the drop down menu to all files)
4. run "cmd.bat" and type "npm init"
5. enjoy your results

imperialcorn
Автор

This guide is really helpful, you really deserve more views likes and subs.
Good job!

lHmania
Автор

Have literally never coded a thing in my life, and was able to do all this no problem. Thanks a ton! Extremely helpful.

viktorfrankenstein
Автор

great video! i've been trying to make a bot in python all day but i couldn't get it to run, so i decided to try this and it's working great! thank youuu

wommiez
Автор

Hey, nice video. Which extensions are you using in this video?

TheZiipen
Автор

A few typos and forgot-to-save-file later... It works! Wow! This really is super cool and kinda exciting. Thanks for making this, it's a great intro to making a Discord bot! *woof*

WolfRawrrr
Автор

The discord channel is very helpful! Lots of members are helping me! Even the owner!

Lucas-qmxn
Автор

I have a strong feeling i'm gonna hear the whistling in the following episodes :D Nice work, keep it up

paintheworld
Автор

First time doing this and I am so happy thank you so much.

importantimportant
Автор

This isn't outdated. All you peeps saying that gotta stawp. It worked for me, it'll work for you, just take your time and don't overthink it.

ananaperiy
Автор

when i typed "node ." to bring my bot online, it had no output. could someone help me? i'm sure i added the node program.

ians
Автор

If you having trouble with "node ." save the index.js file ( ctrl+s) than type in node index.js

boboV
Автор

A thing a found useful is that if your code doesn't seem to work but it's the same as the one in the video just save all, close Visual Studio, open it up and then try running it again. That's how I got my bot online.

flyingpig
Автор

This is amazing! also everyone make sure to save your changes.

AndreW-odzt
Автор

I'll explain how the bot works so you guys new to JS programming can fill in the missing gaps.

Node.js is a wrapper for Javascript. What does that mean?
Well, the only thing that defines Javascript is the syntax (which is how you structure the code unique to the programming language). In this case, we always lay out our IF statements the same, our functions and variable declarations. What makes node.js different to our browsers is that Javascript runs on the same syntax, but the object names are different. Actually both node.js and the javascript in your web browser run on the same engine, they just have different object sets with different instructions. You'll never find the document object in node!

When you use npm install discord.js --save you're downloading more instructional objects the javascript engine can understand, and they're specifically designed to work with the Discord bot API.

const is a variable declaration like var and let. Except base value of a constant isn't meant to change. The require(discord.js) is a special node.js function that imports the discord library you installed with npm into the node.js wrapper.

const bot = new discord.client() is a way to shorten your code. You actually don't need to include this, but it will make coding your bot damn easier. discord.client is an object that contains lots of functions designed to work with the discord API. Using the new keyword, you're assigning the object to the variable meaning you can reference all the functions of the discord library with "bot" instead of "discord.client" which is longer.

With the new bot object you're created which is essentially a rename of the discord.client() object, you can use another node.js and discord exclusive method called login which, again, is a pre-written method by the discord library designed to specifically authenticate you with discord's API.

Hopefully you get the setup and sorry for the rushed comment but I don't care!

jackwright
Автор

Thanks for the guide, will be implementing your tips soon on our server!

cjayride