Learn to create a Discord bot using Discord.js in Node.js. This video walks through setting up a node project, creating a Discord application, and writing code for authentication, slash commands, and bot interaction. Code: https://thecodingtrain.com/tracks/dis...
Watch this video adfree on Nebula https://nebula.tv/videos/codingtrain...
Code Example: https://github.com/CodingTrain/Discor...
Previous: • How to Set Up a Node.js Project
References:
Discord Developer Portal: / discord
Discord API Documentation: / discord
Discord.js: https://discord.js.org/
Discord.js Guide: https://discordjs.guide/
Discord Gateway Intents: https://github.com/CodingTrain/Discor...
Videos:
Hiding API keys with .env: • 3.4 Hiding API Keys with Environment ...
async/await: • 16.13: async/await Part 1 Topics of...
Timestamps:
0:00 Introduction
3:39 Setting up the Node.js project
5:50 Creating the Discord application
6:24 Inviting your Discord bot
10:11 Enabling developer mode on Discord
10:33 Setting up the .env file
12:47 Code! Getting the bot to log into Discord
18:16 Creating a slash command
24:00 Deploying the slash command
25:53 Listening for the command interaction and executing the command
30:08 How Discord bots communicate with Discord
32:00 Discord.JS documentation
Corrections:
15:45 Intents describe what events your bot will receive and what it has access to. The guilds intent is required so discord.js can internally populate it's cache to limit it's API calls to Discord.
23:49 Using ./ means the import will be relative to the file that the import is made in. Without it the import would be absolute meaning it would be from the root of your Node.JS project
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
Website: https://thecodingtrain.com/
Share Your Creation! https://thecodingtrain.com/guides/pas...
Suggest Topics: https://github.com/CodingTrain/Sugges...
GitHub: https://github.com/CodingTrain
Discord: https://thecodingtrain.com/discord
Membership: http://youtube.com/thecodingtrain/join
Store: https://standard.tv/codingtrain
Twitter: / thecodingtrain
Instagram: / the.coding.train
Coding Challenges: • Coding Challenges
Intro to Programming: • Start learning here!
p5.js: https://p5js.org
p5.js Web Editor: https://editor.p5js.org/
Processing: https://processing.org
Code of Conduct: https://github.com/CodingTrain/Codeo...
This description was autogenerated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...
#discordbots #javascript #nodejs #discordjs