Create a Discord Bot With Node.js
Why Stack Overflow recommends it
Stack Overflow users mention it as the tutorial they followed when starting a discord.js bot, usually when they hit errors such as missing intents or nodemon hanging after the code diverged from the video.
Recommended by 1 people across 1 different months, 2021 to 2021.
What it is
A 77-minute Traversy Media tutorial, taught by guest presenter Anson the Developer, that builds a Discord bot with Node.js and discord.js. It covers project setup, creating the Discord application, logging in, message events, chat commands, kick and ban commands, reaction roles and webhooks.
What people said
Recommends Kashi Wolfe · 2021-09 · Stack Overflow · on “Nodemon suddenly stuck in "clean exit - waiting for changes before restart" after adding discord.js command”
I'm using node.js + discord.js on vs code, this is also my first time coding, so excuse my ugly formatting etc etc. Everything is up to date and was running perfectly fine until it just... didn't. It's driving me nuts and none of the solutions that worked for others has worked for me. I was following this [this video] tutorial but deviated from it to personalize my bot. Index.js require('dotenv').config(); const { Client, Message, User, ClientUser, GuildMember, ClientApplication, Guild } = require('discord.js'); const client = new Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_TYPING", "GUILD_PRESENCES"] }); const prefix = '!'; client.on('ready', () => { console.log('SHOWTIME!!');
Cites Marcus Wolsey · 2021-05 · Stack Overflow · on “Discord.js Bot Replying to All Commands”
I am using discord.js to create a "text-adventure" bot. The user chooses what they would like to do by replying a, b, c, or d. I have separated the questions by using a variable called "stage". The problem is, the bot does not let the user choose the next choice, but instead uses their previous answer. I tried using .lastMessage, but I either couldn't get it to work. That or I had been using it wrong, as I am a bit of an amateur. Below is a bit of code to show you how I handled it. (I removed the story as it got a bit...violent) require("dotenv").config(); var stage = 0; let time = 0; const { Client } = require('discord.js'); const client = new Client(); client.on('ready', () => { console.lo
Cites Sv3ks · 2021-08 · Stack Overflow · on “Discord Bot With Node.js CLIENT_MISSING_INTENTS Error”
So, I'm new at programming JS Discord Bots, but have a few years experience with C#, Java and some other languages. But I'm following this tutorial ( [this video] ), but already at 13:15 I'm off. A ton of things is showing op in PowerShell, and I don't understand. Here you got it: require("dotenv").config(); const { Client } = require('discord.js'); const bot = new Client(); bot.login(process.env.DISCORDJS_BOT_TOKEN); And I get these errors: C:\Users\CENSORED\OneDrive\Dokumenter\discord-bot\node_modules\discord.js\src\client\Client.js:544 throw new TypeError('CLIENT_MISSING_INTENTS'); ^ TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (