Code a Discord Bot with JavaScript - Host for Free in the Cloud

freeCodeCamp.org · 444K views · 2021 · 56:30

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial behind their Discord bot code, both when answering version-related errors and when asking about bugs that came from following it.

Recommended by 2 people across 2 different months, 2021 to 2021.

What it is

A 56-minute freeCodeCamp.org course by Beau Carnes that walks through building a Discord bot in JavaScript with Node.js and discord.js. It covers creating the bot user, coding commands, storing settings in Repl.it's database, and keeping the bot running via a web server and Uptime Robot.

What people said

Recommends Eden · 2021-05 · Stack Overflow · on “Discord Bot to start Minecraft Server”

Nevermind, i found it out myself. I found a good tutorial on YouTube how to program your bot in .js, I was able to add the code there. Here is the vid: [this video]

Recommends Toxmose · 2021-08 · Stack Overflow · on “SyntaxError: Unexpected token '?' when making discord bot in JavaScript on repl.it”

This is probably related to the FreeCodeCamp tutorial Code a Discord Bot with JavaScript [this video] . You can actually use the repl.it shell to solve this. Go to the shell (the tab on the right of the console tab) and enter npm i discord.js@12.5.3

Cites Ethan Agar · 2021-06 · Stack Overflow · on “How to fix an unhandledpromiserejection in repl.it. The error I had said "cannot read the property of q"”

I was following a tutorial YT here's the link [this video] to create a discord bot. But I have an error that I can't figure out how to fix. It says "cannot read the property of q". The only q I have in my code is in the getQuote function. What I'm trying to do is when I type $inspire, the bot will give an inspiring quote. But when I do that it gives the error "cannot read the property of q" and also " const Discord = require("discord.js") const fetch = require("node-fetch") const client = new Discord.Client() const mySecret = process.env['TOKEN'] function getQuote() { return fetch(" [LINK] ") .then(res => { return res.json }) .then(data => { return data[0]["q"] + " -" + data[0]["a"] }) } client.o