You need Node.js and Phantom.js installed on your computer. You also need git, a Heroku account and the Heroku toolbelt.
First, download this repository ZIP.
Unzip it, and move the folder from your Download repository to where you usually code.
Open the folder in the terminal (you can cd
to it). Once in that folder, run:
$ git init
$ git commit -m "Starting from @lewagon's boilerplate"
We need this folder to be a git repository as we're going to deploy it to Heroku.
You can push this repo to GitHub if you wish to share your work or make a backup. Just go to this page. You can also use the Mac client or the Windows client.
Open script.js
in Sublime Text, and write some JavaScript code. You can
then test your script with the terminal:
$ node script.js
When you are happy with your code, do not forget to commit it!
$ git add script.js
$ git commit -m "A description of what I just did."
(Take 10 seconds to think of meaningful commit messages, it's very important)
First create a Heroku app for your bot.
$ heroku create --region=eu --buildpack=https://github.com/ddollar/heroku-buildpack-multi.git
Then, to deploy it (after some commits), just run:
$ git push heroku master
To run the bot on Heroku, just prefix the command you run locally with heroku run
.
For instance, you get:
$ heroku run node script.js