First thing first, you might have already used an app called Discord. It’s an IRC thing used mostly by gamers. You might have been able to join communities with some bots among them, I don’t want to dig in to deeper stuff on how bots are used in an IRC but just think of it as an automation helper tool…. or something like that.
- You must have NodeJS installed. link
- You must have a text editor installed. (Notepad, Sublime Text, VS Code, Atom, etc.)
- A Discord account (obviously…)
First thing first, let’s create a folder for our project (it depends on you on where to put it, it doesn’t matter) and name we’ll name it for now as“greeter-bot”.
Next, let’s create the following files
Now let’s put something in them shall we?
To get your token follow this guide on how to setup a Discord app.
Okay, so now our script relies on some node libraries. so we need to them to get installed to.
Open up your command line and navigate inside the project folder, once you’re in, simply install the dependencies by executing the following command:
npm install discord.io winston --save
RUNNING THE APP
TIME TO RUN THE BOT!
To be able to run the script you simply have to execute the following command:
MOMENT OF TRUTH
Now go to your chat server and make sure your bot is connected and online, then type in to the chat box
!ping it should reply
pong! to you.
CONGRATULATIONS YOU’VE MADE YOUR OWN DISCORD BOT!
Well it’s a start, but you never thought that it was easy huh?!
There are advance topics out there especially if you’ll deep dive in the Discord API. For now this is a good start to setup a bot.
I hope you have learned something on this tutorial, let me know if you have question(s) or issue(s) with your script.
Have fun and keep learning! 👊🏽
(10/12/2017) UPDATE: Thank you guys for supporting my tutorial and I noticed that a lot of people are having some difficulties through out lesson and it seems it’s very difficult to track your issues here, instead please head to https://github.com/renesansz/discord-greeter-bot/issues and report your issues there for easy tracking and archive purposes. Thanks again!
(06/12/2018) UPDATE: For those people who have already served their bot on the server but still getting an offline status. An additional NPM library should be installed (thanks to @axelgreavette):
npm install https://github.com/woor/discord.io/tarball/gateway_v6