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

Wordpress sites

Learn how to code a Discord bot using JavaScript / Node.js and host it for free in the cloud using Repl.it. You will also learn to use Repl.it's built-in database.

🚨 At 13:44, Replit now has a new method for environment variables. Read what to do here:

🔗 Get 3 months FREE of the Hacker Plan on Repl.it (first 1000 people):

This course was developed by Beau Carnes.

🎥 Code a Discord Bot with Python Video:

💻 Full code on repl.it:

🔗 Online code editor:
🔗 Discord Home Page:
🔗 Discord Developer Portal:
🔗 Discord.js library:

Need help with this tutorial? You can ask questions here:

⭐️ Course Contents ⭐️
⌨️ (00:00) Introduction
⌨️ (01:38) Creating a Discord Server
⌨️ (02:27) Creating a Bot User
⌨️ (06:23) Starting a Project in Repl.it
⌨️ (08:37) Coding a Basic Discord Bot
⌨️ (15:44) Improving the Bot
⌨️ (26:35) Using the Repl.it Database to Store Bot Settings
⌨️ (46:08) Testing the Bot
⌨️ (50:22) Creating a Web Server for the Bot
⌨️ (55:06) Connecting Uptime Robot So Bot Runs Continuously

Special thanks to Repl.it for providing a grant that made this course possible.

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:

43 thoughts on “Code a Discord Bot with JavaScript – Host for Free in the Cloud”

  1. I think that teaching programming with Discord and any type of software used in our free time with friends on the internet is the best way to start and understand what we are able to do with coding, great video and great channel, learned alot with y’all

  2. I’ve been looking for that yesterday and boom! My favourite code learning channel delivers.

    You guys are amazing!

  3. I love when you make Discord Bots. I am a big fan of Discord and I really as well love it when Beau Carnes is teaching since he is a sooooo good teacher when it comes to programming

  4. Hendika Nugroho

    Your misspellings and typos actually make the tutorial more understandable, thank you for the great content

    Also your name reminds me of that nosleep series

  5. I absolutely adore this channel, I learned more about coding languages and algebra/calc here than I have in my entire life in school! *It’s a blessing that it’s all free too!*

  6. Thank you, Beau. This tutorial was really good and surprisingly simple and easy to follow! The way you explained the mess of arrays at 19:42 was easily understandable. Hats off to you

  7. Nirbhay Parmar

    What a high level of energy he has so much needed in this type of enthusiasm in our professors.

  8. Montage Clipzxs

    I have no idea how to thank Beau! I’ve been looking around YouTube for a long time on how to host the bot for free! Honestly, thanks Beau!

    1. can anyone help me
      replit doesn’t allow to create .env files anymore …what to do

    2. Montage Clipzxs

      @RomanDler I can help. Replit updated their system and now, in the left side panel, it has a lock. click on that and type in token, but the token in the value, and press add new secret.

    1. @Yuki YGO tried this but kept getting TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client

    2. @Yuki YGO it still dosent work…. is says {client missing intents} from where should i get intents???

  9. Most of these channels dont Include to put in Intents in the “const client = new discord.Client({ intents: [“GUILDS”, “GUILD_MESSAGES”] })”
    If you don’t include these, it will not work and throw up an error

    1. PastEquation922

      @pyropro he teaches you to put it at the top of the code in the video right? there. I’ve just made a change to it.

  10. The style of explanation is incredible! Its like he speaks the Code… never seen this before. Everything makes sense perfectly. Thanks a lot

  11. Parikshit Chavan

    In your package.json, update
    “dependencies”: {
    “discord.js”: “^12.5.3”
    }
    and the tutorial will go smooth for you, without worrying about the updated versions of discord.

  12. Kevin Carvalho de jesus

    Such a perfect tutorial! i thought it was harder to create discord bots, but it’s so easy! Cannot wait to create my own ones.

  13. if code don’t work, in shell do “npm install node-fetch@2.6.1” in shell and hit enter! then type “npm i discord.js@12.5.3” thats should make it work!

    1. thank u soo much dude, this helped me from starting over the entire thing all over again

  14. TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (/home/runner/PessimisticMysteriousDatabases/node_modules/discord.js/src/client/Client.js:548:13)
    at new Client (/home/runner/PessimisticMysteriousDatabases/node_modules/discord.js/src/client/Client.js:76:10)
    at Object. (/home/runner/PessimisticMysteriousDatabases/index.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)

Comments are closed.