Code Your Own Discord Bot - Basics (2021)
Why Stack Overflow recommends it
Stack Overflow users mostly show up with it as the tutorial they followed when their discord.js bot would not respond to commands, and commenters also point newcomers to it as a starting guide.
Recommended by 1 people across 1 different months, 2021 to 2022.
What it is
A short beginner tutorial from the channel Alesh the Dev that walks through setting up a basic Discord bot with Node.js and discord.js. It covers installing the tools, using the Discord Developer Portal and getting a bot online in a server with a few lines of code.
What people said
Recommends Joe Moore · 2021-01 · Stack Overflow · on “Discord bot not responding to commands (Javascript)”
@Jackson there are many coding guides out there like this one: [this video] It is paramount that you understand the basics of Javascript before you look at bots and coding them. I would personally take a quick look at the basics of the language first! Happy coding
Cites Panos · 2021-04 · Stack Overflow · on “My Discord bot does not respond to my messages”
I am making a bot using Python. I am very new to coding with Python and I don't understand a lot of things, I am just following a tutorial( [this video] ) but I am stuck with my bot not responding to my messages. It goes online and offline as intented but it does not respond to my messages. Also it is an administrator in my Discord server. This is my code: const Discord = require('discord.js'); const client = new Discord.Client(); const prefix = '-'; client.once('ready', () =>{ console.log('Money Farmer is online!'); }); client.on('message', message =>{ if(!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(""); const command
Cites Ivanchin Ysevit · 2021-08 · Stack Overflow · on “Discord bot active but not responding commands (js)”
I've searched this before but I got nothing, even if there are many questions very similar. I apologize in advance in case I'm posting the same thing. It is my first time creating a bot. I followed these two videos to reach this point. [this video] [LINK] The problem is that even when the bot is on, it is not catching the ping command. This is the very beginning. I can't continue programming the bot while he can't catch any command. Here's my code of main.js. The only thing I changed is new Discord.client(); to new Discord.Client({ intents: 100 }); because it seems that changed recently. I still don't know what is an intent and what number should I put there, but it seems that the bot turns on wh
Cites MrPureSalt · 2021-09 · Stack Overflow · on “discord.js bot not responding to commands”
I'm following a tutorial on [this video] (I'm very new to coding and wanted to start somewhere, also I needed a bot). The code was working fine until I started adding some more commands such as -play and -leave . After that the bot doesn't responds to any commands. I've tried changing the prefixes, starting from scratch, and just copy-pasting his code to mine. The bot turns online, but its almost like the code that makes him respond isn't there. Here's my code: const Discord = require('discord.js'); const client = new Discord.Client({ intents: [] }) const prefix = '-'; const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(f
Cites Saharsh · 2022-04 · Stack Overflow · on “How do i add slash commands discord.js”
So i followed Codelyon [LINK] 's Code Your Own Discord Bot 2021 [this video] playlist on youtube and i used his advanced command handler and updated it a little bit by modifying/adding my own commands but then i would like to change his regular advanced command handler with slash commands but i have no idea how to implement it. I've watched some other tutorials but they don't seem to work. Hopefully someone can help me out. Code of the main.js file: const Discord = require('discord.js'); const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES'] }); const prefix = '!'; const fs = require('fs'); client.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./comma
Cites user19713442 · 2022-08 · Stack Overflow · on “Discord bot loading but commands are not working”
I'm making my first Discord bot and I'm following this tutorial playlist here: [this video] But for some reason my bot will load, say the load message, and even set its custom status but none of the commands are working. I have looked at many other forum posts and none are my problem so I'm very confused. I'm using Discord.js 14.3.0 and Node.js 16.17.0 on my Windows 10 machine. Here is my code: const { Client, Discord, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, ], }); const token = ("REDACTED"); const prefix = '!'; client.once('ready', () => { console.log('Bot is online!') client.user.setActivity('