
I\'m supposed to be writing this for discord bots in python but I want
to test my heroku terraform thing so here we are using javascript.
Documentation for the discord.js package can be found
[here](https://discord.js.org/#/). These maintainer(s) have written a
nice guide on creating a bot from discord developers so please read
[this](https://discordjs.guide/preparations/setting-up-a-bot-application.html).
Assumptions
-----------
-   You understand JS/node on a basic level
-   Node is installed on your computer
-   You have a discord \"bot\" token
------------------------------------------------------------------------
Discord Bot Files
-----------------
We will constantly be running this bot from heroku. My suggestion as we
get started is you have your project folder, and then inside have a bot
and terraform folder. This goes inside of the bot folder.
#### 1. procfile {#1-procfile}
    worker: node index.js
#### 2. package.json {#2-package-json}
    {
      "name": "terraform_bot_test",
      "version": "1.0.0",
      "description": "discord bot to go with terraform test",
      "main": "index.js",
      "dependencies": {
        "discord.js": "^12.5.3"
      },
      "devDependencies": {},
      "scripts": {
        "test": "test",
        "start": "node index.js"
      },
      "keywords": [
        "bot",
        "discord",
        "terraform"
      ],
      "author": "Backpack Media LLC",
      "license": "ISC"
    }
#### 3. index.js {#3-index-js}
    const Discord = require("discord.js")
    const discord = new Discord.Client()
    discord.login("DISCORD_TOKEN_HERE")
    discord.on('ready', () => {
        console.log('I am ready!')
    })
    discord.on("message", msg => {
        if (msg.content === '!bored') {
            msg.channel.send('Do 10 pushups')
        }
      })
4\. Take this time to run `npm install` inside the bot folder and grab
some water
5\. Once everything is clear run `node index.js`. You should see the \"I
am ready! message.
6\. Go to your discord server and post `!bored`
7\. Rejoice!!!!
Now that we know our bot is working locally we need to get it on heroku.
Like I mentioned before, to be fancy we shall use terraform. See you in
the next step.
------------------------------------------------------------------------
Part 2: Setup Heroku
Part 3: Combine everything