Skip to content
← Back to Community
Tutorial: Building a Discord bot with Node.js
Profile icon
h
has Hacker Plan
GarethDwyer1

Hey all,

This is the Node.js version of my tutorial on building Discord chatbot's (the other version is in Python). I'm watching the comments here and at codementor, so shout if you have any questions!

https://www.codementor.io/garethdwyer/building-a-discord-bot-with-node-js-and-repl-it-mm46r1u8y

Voters
Profile icon
BLKOFFICIAL
Profile icon
Killdod
Profile icon
aimnsyaaa
Profile icon
abd-alrmanalrma
Profile icon
GameSame
Profile icon
Rosinha0803
Profile icon
mryordii
Profile icon
Dual103
Profile icon
myomation
Profile icon
mbarri6000
Comments
hotnewtop
Profile icon
MrSarthak

how to type??????

Profile icon
Brawn

Two questions
1)Could you do all of the steps in a browser or do you need the app to do it?
2)Is the code too advanced for a beginner, or is it do able with the basics?
I am a newbie in programming "for now" and I was interested in this challenge hoping that I could learn some js during the process. I would also love some tips for how to learn a language for a beginner like myself.
I would also like to hear your opinion on Rust, which I am attempting to learn. Things like is it too hard for a new comer and if it is worth learning

Profile icon
ChristopherRoch

@Brawn To try and answer your questions:

  1. Yes. Repl.it has a built-in IDE that can work in Node.js, and you can access Discord in the browser (though I'd personally recommend to use the app).
  2. I would say that a Discord bot is a great way to start programming. You'll be working with mostly discord.js' functions, which read very much like English, and only need to know things like if statements, and for loops.

As for Rust, I've never played it so I can't comment.

Hope this helped!

Profile icon
Nathan_42

@ChristopherRoch Lol hes talking about the programming language

Profile icon
tomatosoup1

everytime i run a bot (or try to) it says "node: not found" and "exit status 127". yes the replit file does have run = "node bot.js" instead of any other variant/mistake of it

Profile icon
GarethDwyer1

@tomatosoup1 did you fork the repl linked in the tutorial? I just tried and it worked fine for me. (You also have to add a token from Discord, as described in the tutorial).

It is a bit outdated -- e.g. the .env file isn't used any more, so we will update this one soon!

https://replit.com/@GarethDwyer1/discord-bot-node#index.js

Profile icon
nialgue2011

i can´t you shose serpent
im spanish no shaver inglish sollo spanish

Profile icon
VXZELL12345
Profile icon
zoro5

</>

Profile icon
1avpinksfeld

how and where do i learn if i have no coding experience?

Profile icon
GarioDev

thx

Profile icon
Albxyiscool

How do i make a command

Profile icon
GarethDwyer1

@Albxyiscool just check if the input starts with an exclamation mark or however you want to run your commands. e.g.

if(message.charAt(0) == '!') { // logic for your command }
Profile icon
bobjeffco

thank you for this tutorial! it works very well.

Profile icon
ryosan1210

Hello.
I'm Japanese so I can't write English well. I'm sorry.

I have a question.
I can't run my project. There is sentence in console.
It is "exit status 127".
So I can't run my project.

Profile icon
GarethDwyer1

@ryosan1210 can you share a link to your project?

Profile icon
GarethDwyer1

[email protected] your .replit file is wrong. Change the 'run=' line to

run = "node main.js"
Profile icon
ryosan1210

@GarethDwyer1 I can run my project!
Thanks!!