Source for @readyforspoons a bot that makes random fake (but disappointingly real) Brexit posters
It'll fetch a random noun from a master list of nouns and then it make a webpage out of it, screenshot it and tweet it.
I recommend reading the code itself, (start at app.js
!) it's pretty straightforward and simpler than that mouthful of an explanation!!
-
Clone this repo
-
Run
npm install
to get all the dependencies. This will take a while. While you wait, talk about how you're negotiating a better deal for Britain with the person closest to you. -
Run
node
and you should get a link tohttp://localhost:3000
, showing a massive disappointment. Browser support is very flaky. -
To take screenies, run
node ./bin/screenshot.js
-
To post to Twitter, you first need to make an app at apps.twitter.com (this is where the bot will post!! be careful) and get all four tokens (2 for the app 2 for the user). Then make a .env file filling in the values you see in
./bin/tweet.js
. Then just runnode ./bin/tweet.js
The actual live @readyforspoons is in sync with this exact codebase, it's hosted in heroku, which has a free forever tier, and there's a scheduled process that runs node ./bin/tweet.js
hourly