DiscordJS Tutorial - Create a Discord Bot from Scratch

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

Enjoy? Sub up!

- - - - - - - - - - - - - - - - - - - - - -

Subscribe for NEW VIDEOS!

^-Chat with me and others

- - - - - - - - - - - - - - - - - - - - - -

Come to my discord server or add me on social media and say Hi!
Рекомендации по теме
Комментарии
Автор

What a great introduction for someone like me who hasn't had any noteable exposure to JavaScript so far! Thanks for making this video!

Thiesi
Автор

to avoid CTRL+C and re-running, you can 'npx nodemon index.js' - will re-run the file everytime you save.

vkd
Автор

I love how you ended up showing the token in the end anyways
xc

titus
Автор

Great tutorial! For the people who are saying it does not work save all the files then run it again.

miskadev
Автор

For anyone I guess:

"mk dir bot && cd bot" makes a folder and then the console/terminal will do commands within that folder. However, if you exit, it won't put you back. "Users/name/code/bot" becomes "users/name/code/" or something. To go back to the right folder, use "cd bot" (replace "bot" with the name of the directory you made) to start commands back there

HaydenTheEeeeeeeeevilEukaryote
Автор

Few small nits:
--save is default action from npm 5.0.0. Current version is 6.9.0;

In your message event you don't ignore messages sent from bots. That allows for exploits with other bots and simple command like !say, but also, if someone decides to continue adding more commands, it can eventually lead to bot endlessly triggering on its own messages.

You also should check if message.member exists. Why? Because there are 2 possibilities other than expected result
1) Since Discord.js depends heavily on its own cache, message.member is **not** reliable if guild has more than 250 members, because after that point library will not cache all members of the guild. If member is uncached, it's simply null, so null.hasPermission() is straight error. To avoid that, you should use guild.fetchMember(), as it checks cache before performing actual API request for the member.
2) message.member does not exist if message was sent in DMs. There's no guild in DMs. In such case member is also null, so same thing as in point 1.

You also don't do any checks if anyone was actually mentioned. while is correct way, it can be undefined, and undefined.kick() is also not a thing.


Sorry if that may sound in any way offensive, but i'm one of people who give support on discord.js official discord, and those are one of most common issues we help with, and for same reason we tend to not point to tutorials on youtube, as they are way harder to update in such cases.

tipakA
Автор

The part at 18:45 didn't work for me at first, but one of your lovely moderators helped me out and it works now!
So everyone that needs help, try joining his discord it's great!
titus i will for always love u

yuwib
Автор

2+ decades experience.... maaan, you look young

ShiNijuuAKL
Автор

I thought it said "How to create a Discord Bot *with* Scratch"




dang that must take some ballz
Wow thanks for the likes. 👍

Praybait
Автор

I'm so glad this is new and not outdated or something like I'm used to.

HaydenTheEeeeeeeeevilEukaryote
Автор

this was the best bot tutorial i've ever watched

soft
Автор

Rule 1 : never use light theme (my eyes are hurting)
Rule 2 : never forget rule 1

toonflix
Автор

If you have trouble with node index.js
press ctrl +s it will save index.js
then in the terminal do ctrl +c
and type node index.js

ishaaqsuffyan
Автор

I generally don't like javascript but you made it more understandable and easy

Zippy
Автор

I've just fixed an issue. If you're using powershell in the terminal follow the steps:
Switching from powershell to cmd in visual studio

1. Press Ctrl+Shift+P to show all commands.
2. Type shell in the displayed text box to filter the list.
3. Select Terminal: Select Default Shell.
4. You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now
5. Select Command Prompt (cmd.exe)
6. Click the Delete Icon in the shell pane to remove the existing terminal.
7. Press Ctrl+` (or View > Terminal in menu) to open a new terminal pane.

If this helped tell me

adadadsdads
Автор

For those of you who didn't manage to get the bot online, here's how to do it.

You have to go up and find the "Run" menu, and then find the option, "Start Debugging".

If your code is correct, then the terminal should say ready when the bot is online.
There also appears a little window of some buttons, including a stop button to stop the bot from being online, so you can continue working on it.

sorin_ea
Автор

I Need Help My Bot Doesnt Run When I Do node . or node index.js

lancetaoy
Автор

Watched it, got hooked to JS and bot making!
Thanks!

irg.r
Автор

THANK U SO MUCH!!!! I MADE A BOT THANKS! U EARNED YOURSELF A SUB!

blur
Автор

thank you very much, that made a very long time than i search a true tutorial who learn to program a discord bot in d.js and you're the only one who make real tutorial i'd subscribe to your channel and drop a like !!

minaraitheboreddariusmain