@@sach2274 I am waiting a bit for that. Still doing everything with Node. I don't want to just create a course to jump on the bandwagon. When Deno is more established and I use it more, then I'll do a course on it
I want to thank you for using the documentation, this was the first time I used a documentation FOR REAL, and I'm getting very far because of this. Because of you I know how to read a documentation and you changed my programming life forever. Thank you.
Dude, I've been feeling down lately when it comes to self-taught programming, but after watching this video, it reignited my need to learn more. Thank you Brad and Anson!
I dont know why this specific tutorial made me get it but I now understand the spread operator much better because of this simple real world example...Thank you!
Just finished watching (thank goodness for YT 2x speed) and I can't believe how good the discord.js documentation appears to be. I am actually looking forward to writing this bot now, as I was procrastinating on it before. I'll be combining this with a nodejs web scraper as well, where the bot will scrape online user rankings and provide them via chat message commands. 10/10 would learn again :)
Thank you for creating this tutorial, I watched the whole thing through and I have learned allot. I can't wait to finish off my bot and have it ready within a few days :).
A good video, made by someone who knows what is doing! SADLY some things in this video, like the initial part while setting up the project and some other commands are now deprecated and have changed. For these things, I reccomand to watch a newer video and setup the project, then you can continue with this video, because is soo good in the explaining and making! hope this can help!
This is a great introduction! However several things are outdated such as the hasPermissions, and I think args too. However this is a great introduction. For all of you still watching I recommend asking a friend who knows alot of code to help you "update" the code.
hey Brad you really make me happy even at difficult times by posting such videos. Wishing you and your channel the best of luck for the upcoming future
NOTE FOR ANYONE WATCHING AFTER DISCORD API 13: there are many changes like you have to specify intents while creating client and instead of message event its now messageCreate event
As someone who has a beginner with coding in Java, this video is the push I need to get onto the next level. I've spent that last couple of days trying to understand what the code means, how it works, and nothing seems to give me a basic idea. All the tutorials and explanations I've seen are usually just 'copy and paste this, don't worry too much about what it does'. The first 10 minutes of actual coding in the video was more informative than the last 2 days of me trying to find explanations all around the internet. It is beyond me how this isn't the first thing that shows up when you try and learn how to code a discord bot.
why do i have so much trouble pinging when i type node ./src/bot.js I hit it one time and every other time i try to run i get an error it cant locate module
@@Leon-yd7qh any luck on figuring it out, I came back the next day to give it another try but I'm still stuck on this part. I've also checked the code in the descriptions and it looks like I'm missing some info in the "package.json", mine does not have the "start": "node ./src/bot.js", "dev": "nodemon ./src/bot.js" and also under the "discord.js": "^12.2.0", I do not have the "dotenv": "^8.2.0"
THX A LOT MAN! u dk how much u helped me to make money for my life and make my and other ppl dream come true with it! amazing! i never found a good tutorial but this! idk how to thank ya man...just as we americans say: God Bless u❤️🇺🇲
Is there a way that the bot detects a keyword in a phrase? So you did if someone says hello the bot will respond hello. What if someone says "Hello guys!". Is there a way that the bot detects the "Hello" and will return a message?
7:30 When attempting to run code: "Error: Cannot find module 'dotenv' code: 'MODULE_NOT_FOUND'" Regardless of where ".env" is placed, it might as well not exist Stuck even before i have started -.-
@@loradio537 The solution was that you have to install "dotenv" module with console command "npm install dotenv". Being a newbie with JS at the time I assumed it was a core module already contained within Node like "fs"
If possible would you mind collectively sharing your thoughts on memorization? In a previous video Brad mentioned recording ones self which I think would greatly help, instead trying to do so for my daughter.
For me, the discord.js guides aren't as great and helpful as I'd like for quite a few things, maybe it'll help to make yourself your own guide in a txt file or similar, or even a js file to define some global variables that you can remember instead of the default path of discord. For example: Module.exports.bot = { const Client = require('discord.js') const client = new Discord.Client //message constants const msg = message.channel.send(); const reply = message.reply(); const getUserId = message.author.id(); Function searchById( id, runthis ) { id runthis } }; //And in the files you need to use these newly defined (hopefully easier to remember) constants, you would require it by its path, so, const exports = require('./mypathhere.js'); //And then asking it to use those would take your constant And the name of your module.exports, (which is asking it to require the file, then look through the module.exports there and that would be exports.bot.NEWCOMMANDSTUFF) so lets shorten that to: const bot = exports.bot //And now when you want to use a command: client.on('message', message => { bot.msg('hoi'); bot.reply('this one tags you') var userId = bot.getUserId(); bot.searchById(id, runthis){ id = bot.getUserId(); runthis = {code to run that uses that id you just got} Or to shorten that, bot.searchById(bot.getUserId, runthis=>{stuff to run here}) } }); The constants will definitely work, the function may not be written exactly how it should be, I'm writing this from mobile so I'll check back when I get the chance to. I hope this helps! My discord is Chai#0027
mate... jesus christ man... i was using glitch.com and then i got a message from discord saying the token was posted on the internet (which is very bad) meaning hackers could easily go into your projects and this completely stops that tysm man 💕
Hi i have a problem when i start in powershell i was typing npm init -y it wasnt working it was showing the terms npm init and -y are not recognized could be great if you help ...
The code for kick and ban are broken I was thinking I did something wrong so I downloaded the code and it still said that the member was not found. Can you please help? Edit: only the code for kick command is broken.
I liked the video, very informative, I haven’t tried your method yet, but I’ve done similar written around similar times and it seems bots are bit different now with intents needing to be declared. Has anyone found any good .js videos that are more up to date?
For anyone who gets the TOKEN_INVALID error when they try to run the bot, try this: Instead of "client.login(process.env.DISCORD_BOT_TOKEN);", try "client.login(process.env.TOKEN) Hope this helps!
WHY?? Your environment has been set up for using Node.js 14.15.4 (x64) and npm. C:\Users\capou>cd onedrive/plocha/discordjs-bot-starter-master/node ./scr/discord.js Systém nemůže nalézt uvedenou cestu. C:\Users\capou>cd onedrive/plocha/discordjs-bot-starter-master C:\Users\capou\OneDrive\Plocha\discordjs-bot-starter-master>node ./scr/discord.js internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module 'C:\Users\capou\OneDrive\Plocha\discordjs-bot-starter-master\scr\discord.js' [90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)[39m [90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)[39m [90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)[39m [90m at internal/main/run_main_module.js:17:47[39m { code: [32m'MODULE_NOT_FOUND'[39m, requireStack: [] }
I implemented that! :p So as you know, each user is a key value pair, where the key is the id and the value is the name (and I think it goes both ways, that is the name can identify the key as well). But discord in general likes to work with keys. So when you tag a person you want to kick, it automatically converts to a string From there on you could just use substring method to take the id out. This would be better than what crispy mentioned ig since you could kick/ban multiple users in the same command now
I have a news website and I want to post news feeds to the discord group when the news is posted on my web that is automated. Whether can I code bots like that. And can you give some keywords to do? .. .Thanks for all you do!
you're probably not in the correct directory if you're just using a raw powershell/terminal. You'll need to cd into your working directory for that to work.
I installed nodemon for the first time and got an error "Cannot find module 'D:\\ ... \index.js". The solution was simply a matter of changing a value in the package.json file, from "main":"index.js" to "main":"./src/bot.js". In case someone else encounters the same problem.
Thank you SO MUCH BRAD for this amazing opportunity to do this video. Hopefully this will bring more attention to the Discord Bot Dev community :)!
You're very welcome, thanks for the great project. Anyone wanting to get more into this, Anson's channel is amazing
@@TraversyMedia waiting for your deno course bro :)
@@sach2274 I am waiting a bit for that. Still doing everything with Node. I don't want to just create a course to jump on the bandwagon. When Deno is more established and I use it more, then I'll do a course on it
@@TraversyMedia Thank you bro...appreciate your work :)
Thanks.
@@TraversyMedia 👍 🙏
I want to thank you for using the documentation, this was the first time I used a documentation FOR REAL, and I'm getting very far because of this. Because of you I know how to read a documentation and you changed my programming life forever.
Thank you.
Dude, I've been feeling down lately when it comes to self-taught programming, but after watching this video, it reignited my need to learn more. Thank you Brad and Anson!
How are you doing with self taught programming now? I'm personally kinda new, but it'd be cool to know how far you've gotten after a year.
@@smol2431 how bout u now after a year with self taught ?
@@batbeo7423 skillful
I dont know why this specific tutorial made me get it but I now understand the spread operator much better because of this simple real world example...Thank you!
YESSS I was just looking to make a bot, so this couldn't come at a better time! Thanks Brad & Anson!
Just finished watching (thank goodness for YT 2x speed) and I can't believe how good the discord.js documentation appears to be. I am actually looking forward to writing this bot now, as I was procrastinating on it before. I'll be combining this with a nodejs web scraper as well, where the bot will scrape online user rankings and provide them via chat message commands. 10/10 would learn again :)
where do you get that windows terminal that makes folders and stuff 2:31
@@blinko2092 power shell
Thank you for creating this tutorial, I watched the whole thing through and I have learned allot.
I can't wait to finish off my bot and have it ready within a few days :).
A good video, made by someone who knows what is doing!
SADLY some things in this video, like the initial part while setting up the project and some other commands are now deprecated and have changed.
For these things, I reccomand to watch a newer video and setup the project, then you can continue with this video, because is soo good in the explaining and making!
hope this can help!
Any videos in particular?
I'm glad he got in at 1:35 instead of talking for like 10 hours like all other youtubers
Running into "Error: Cannot find module 'dotenv'"? just type:
npm install dotenv --save
And try to run the server again. You're welcome.
this deserves more likes. thank you so much.
You know the level of computer proficiency of a person when he uses the terminal just to create a folder.
Very cool, something I was looking to do for a while
Thank you very much i failed many times making but i think i will succes now thanks anson and traversy media i will sub for sure
This is a great introduction! However several things are outdated such as the hasPermissions, and I think args too. However this is a great introduction. For all of you still watching I recommend asking a friend who knows alot of code to help you "update" the code.
hey Brad you really make me happy even at difficult times by posting such videos.
Wishing you and your channel the best of luck for the upcoming future
This video is pure gold, thank you so much
NOTE FOR ANYONE WATCHING AFTER DISCORD API 13: there are many changes like you have to specify intents while creating client and instead of message event its now messageCreate event
Yeah bro most of this video is invalid after the first like 5 minutes now unfortunately :(
@@andrew3606 For anyone with this problem, an easy work around is to just degrade the version of discord.js that you're using. npm i discord.js@12.5.3
@@jaredmedeiros8421could i still host the bot in the outdated API?
Learning a lot from the Node JS projects. This is amazing 💯✔
You have received a like my friend. This is very helpful so far!
26:06 Missed opportunity for a classic "Hello There" > "General Kenobi" joke :D
lmao
Thank you sir actually you are teaching immersive things
you r awesome bro you helped me with this video a lot even i got better in javascript with your video lots of love bro
You're awesome. Thank you. This will be my fun for a long time and also will teach me many things :)
Ne demek 🙌🏼
Legitimate tutorial for a beginner 😁
Learning discord.js after discord.py, let's see which one is better wrapper for discord bot
As someone who has a beginner with coding in Java, this video is the push I need to get onto the next level. I've spent that last couple of days trying to understand what the code means, how it works, and nothing seems to give me a basic idea. All the tutorials and explanations I've seen are usually just 'copy and paste this, don't worry too much about what it does'. The first 10 minutes of actual coding in the video was more informative than the last 2 days of me trying to find explanations all around the internet. It is beyond me how this isn't the first thing that shows up when you try and learn how to code a discord bot.
always dropping 🔥
I love the fact that Anson started recording at 6 AM
This video was really helpfull! And that what I been looking for! You gained a sub!
why do i have so much trouble pinging when i type node ./src/bot.js I hit it one time and every other time i try to run i get an error it cant locate module
i couldnt get that to work could you help me
@@Leon-yd7qh any luck on figuring it out, I came back the next day to give it another try but I'm still stuck on this part. I've also checked the code in the descriptions and it looks like I'm missing some info in the "package.json", mine does not have the "start": "node ./src/bot.js", "dev": "nodemon ./src/bot.js" and also under the "discord.js": "^12.2.0", I do not have the "dotenv": "^8.2.0"
Very helpful. Advice: can you show how this app/bot work in the begging of the video and then show how to build it
superb bro your teaching is very nice thankyou for this video love from India
I was looking 4 this tutorial so long 😂
just gonna boooookmark this for later.... :D
really looking forward to following along with this when I get the chance! thanks for sharing
No programming knowledge whatsoever and this was a great tutorial and easy to follow :)
Love YOur Video Bro This Is Amazing!!
man i learned so much, thank you :)
THX A LOT MAN! u dk how much u helped me to make money for my life and make my and other ppl dream come true with it! amazing! i never found a good tutorial but this! idk how to thank ya man...just as we americans say: God Bless u❤️🇺🇲
thank you so much. It's very useful video. Because of it i could create my discord bot:)
This was really fun to do thank you so much! I was wondering if this setup allows for embedded stuff?
Gold. This helps a LOT!
Please Invite Ben Awad, this guy is a champ;)
i find him quite toxic
@@mnl6042 I suppose you are an angular developer :|
I believe I sent him an invite. I'll check
@@mnl6042 Not at all! That guy is ❤️
@@ishanvarshney9054 No, but i dont like the idea bashing something established just because you dont like it
When you get started with the toturial
Me : brain.exe has stopped
Not funny
@@atanki5682 "not funny"
I mean, the brain is more of an os
another quality content thanks brad I'm waiting for this!
yo, tnx for tutorial! i love is so much!
I completed the whole thing. :) thansk
thank you soooo much my bot works coz of u i have nothing to say but thanks
I think bot development is a really good way to get to grips with using NodeJS.
This is awesome. I've been wanting to see a Discord video like this
the only coding tutorial that I have had to speed up
Thank you brother 💓
Been looking for this one these days :) ty
this good content needs more views!!
18:07 . Person.exe has stopped working
thank you for this amazing initiative traversy media. For getting us touch with lots of hiden gems
This is really helpful
what am i doing wrong? the command isnt working
I’m gonna assume that you have knowledge ob the javascript language - proceeds to explain every detail
this vid was very helpful
It seems like opting into partials doesn't change the fact that my bot doesn't respond to reactions on old messages... I don't know what I did wrong.
Having the same issue.
Was able to get it to start working by restarting the Node application
when i type node ./src/bot.js it dosent type my token it just says nothing could you help me please
same
@@kingstradeshorts same
const client = new Client({intents: ["GUILDS", "GUILD_MESSAGES"] });
Is there a way that the bot detects a keyword in a phrase? So you did if someone says hello the bot will respond hello. What if someone says "Hello guys!". Is there a way that the bot detects the "Hello" and will return a message?
Such a shame they stopped giving the badge. Anyways, loved the video
7:30
When attempting to run code:
"Error: Cannot find module 'dotenv'
code: 'MODULE_NOT_FOUND'"
Regardless of where ".env" is placed, it might as well not exist
Stuck even before i have started -.-
same
@@loradio537 The solution was that you have to install "dotenv" module with console command "npm install dotenv".
Being a newbie with JS at the time I assumed it was a core module already contained within Node like "fs"
@@razinoid6863 joke's on me then, I already have it installed bot still won't run
Thank you for a great tutorial. Do you have an example of how to request a stock quote info from Alpha Vantage and parse the data?
FIRST OF ALL! Anson and Brad! Another good combination
Hello, what Extensions you are using. it looks simple and beautiful and might help me on coding bots! thanks
If possible would you mind collectively sharing your thoughts on memorization? In a previous video Brad mentioned recording ones self which I think would greatly help, instead trying to do so for my daughter.
For me, the discord.js guides aren't as great and helpful as I'd like for quite a few things, maybe it'll help to make yourself your own guide in a txt file or similar, or even a js file to define some global variables that you can remember instead of the default path of discord. For example:
Module.exports.bot = {
const Client = require('discord.js')
const client = new Discord.Client
//message constants
const msg = message.channel.send();
const reply = message.reply();
const getUserId = message.author.id();
Function searchById( id, runthis ) {
id
runthis
}
};
//And in the files you need to use these newly defined (hopefully easier to remember) constants, you would require it by its path, so,
const exports = require('./mypathhere.js');
//And then asking it to use those would take your constant And the name of your module.exports, (which is asking it to require the file, then look through the module.exports there and that would be exports.bot.NEWCOMMANDSTUFF) so lets shorten that to:
const bot = exports.bot
//And now when you want to use a command:
client.on('message', message => {
bot.msg('hoi');
bot.reply('this one tags you')
var userId = bot.getUserId();
bot.searchById(id, runthis){
id = bot.getUserId();
runthis = {code to run that uses that id you just got}
Or to shorten that,
bot.searchById(bot.getUserId, runthis=>{stuff to run here})
}
});
The constants will definitely work, the function may not be written exactly how it should be, I'm writing this from mobile so I'll check back when I get the chance to.
I hope this helps!
My discord is Chai#0027
Side note, probably better to define your client by requiring the main file so you dont have multiple instances of new clients.
mate... jesus christ man... i was using glitch.com and then i got a message from discord saying the token was posted on the internet (which is very bad)
meaning hackers could easily go into your projects and this completely stops that tysm man 💕
Waiittt, its Ansonnn!!!
should've used eris, good tut either way ^_^
Bro , do we need to learn something before starting this course??
Hi i have a problem when i start in powershell i was typing npm init -y it wasnt working it was showing the terms npm init and -y are not recognized could be great if you help ...
Only the first set of random keys are the same the rest gets randomized.
I hoped so much this would be in TypeScript. Good video anyways! :)
You could follow along in TS, doesn't seem too hard
wish you could explain what is a discord bot at the beginning
Subscribed
please don't refer this video as version is changed by now, I personally faced a lot of troubles while in making
Any alternate tutorial or NodeJS project u can suggest as i am getting ready for a company with NodeJS specially.
Thank you
Stuck on the "console.log(process.env.DISCORDJS_BOT_TOKEN);" because it doesn't log anything. Time to restart :D
Hopefully you did npm install dotenv ... just to make sure it reads the .ENV file ❤️
I didn't save BOTH files so it wouldn't load, hope it helps.
For me it just said Undefined
@@mint2d you are a god, thank you, iv been stuck at this point for hours
@@Leon-yd7qh welcome to the ctrl + s , everything phase xd
+REP! ILOVE YOUR VIDEOS
thanks a lot bro
When I type "node ./src/bot.js" it just pops up the folder again & the bot won't start
How did you fix it?
same here, if anyone has the answer id really appreciate it.]
try to use
const client = new Client({intents: ["GUILDS", "GUILD_MESSAGES"] });
The code for kick and ban are broken I was thinking I did something wrong so I downloaded the code and it still said that the member was not found. Can you please help? Edit: only the code for kick command is broken.
I liked the video, very informative, I haven’t tried your method yet, but I’ve done similar written around similar times and it seems bots are bit different now with intents needing to be declared. Has anyone found any good .js videos that are more up to date?
If you find any please tell me too all of them are outdated
@@maevesilvestrys5600 I gave up on .Js and went with C# since I’m slightly more familiar, much easier IMO
@@maevesilvestrys5600 this is the video I used that helped me the most ua-cam.com/video/IcnuPWyxMes/v-deo.html
Thank youuu so much!!!!❤❤❤
i REALLY cant understand the beginning. nothing even pops up in my package.json
For anyone who gets the TOKEN_INVALID error when they try to run the bot, try this:
Instead of "client.login(process.env.DISCORD_BOT_TOKEN);", try "client.login(process.env.TOKEN)
Hope this helps!
can someone help when you said i like to make a folder and named it src it didnt look like the icon on his screen welp
He's using a icon extension called "Material icon" , it's available in Visual Studio Code
WHY??
Your environment has been set up for using Node.js 14.15.4 (x64) and npm.
C:\Users\capou>cd onedrive/plocha/discordjs-bot-starter-master/node ./scr/discord.js
Systém nemůže nalézt uvedenou cestu.
C:\Users\capou>cd onedrive/plocha/discordjs-bot-starter-master
C:\Users\capou\OneDrive\Plocha\discordjs-bot-starter-master>node ./scr/discord.js
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\capou\OneDrive\Plocha\discordjs-bot-starter-master\scr\discord.js'
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: []
}
That was an awesome tutorial thanks ! . btw how can you kick out using the member's actual name is that possible
I implemented that! :p
So as you know, each user is a key value pair, where the key is the id and the value is the name (and I think it goes both ways, that is the name can identify the key as well). But discord in general likes to work with keys. So when you tag a person you want to kick, it automatically converts to a string
From there on you could just use substring method to take the id out.
This would be better than what crispy mentioned ig since you could kick/ban multiple users in the same command now
thank you :D
uhhhh how do i open windows terminal haha
it is not showing username and message please help
hi brad please make a tutorial for "Swiper.js" library...there is no good tutorial for it on UA-cam.thanks
Bruh thank you!!!
Would've been really useful if you took a minute to explain what the bot does right off the top.
@TraversyMedia please make a video, how to make discord bot in 2022 with the new implemented 'slash commands'!
this tutorial is now so much outdated!
I have a news website and I want to post news feeds to the discord group when the news is posted on my web that is automated. Whether can I code bots like that.
And can you give some keywords to do? .. .Thanks for all you do!
when i type node ./src/bot.js it says module not found
you're probably not in the correct directory if you're just using a raw powershell/terminal. You'll need to cd into your working directory for that to work.
I installed nodemon for the first time and got an error "Cannot find module 'D:\\ ... \index.js". The solution was simply a matter of changing a value in the package.json file, from "main":"index.js" to "main":"./src/bot.js". In case someone else encounters the same problem.
I got that for node
Great video Sir, you are the best. really appreciate to you..
maybe some time with Spring boot 😂