This commit is contained in:
Talor Berthelson
2016-06-28 02:17:27 -04:00
parent cde170d9b7
commit 53092b2f02
3 changed files with 30 additions and 13 deletions

32
app.js
View File

@@ -1,11 +1,18 @@
var Twit = require('twit')
var fs = require('fs')
var Screenshot = require('url-to-screenshot');
var low = require('lowdb');
var join = require('path').join;
var childProcess = require('child_process')
var storage = require('lowdb/file-sync');
var session = low('./config.json', {'storage': storage});
var path = require('path')
var childProcess = require('child_process')
var phantomjs = require('phantomjs-prebuilt')
var binPath = phantomjs.path
var _ = require('wegweg')({
globals: false,
shelljs: false
})
var screenshot = require('url-screenshot')
var T = new Twit({
consumer_key: 'XEpOzvNVnIL0z5cFggsZQzrTt',
@@ -22,15 +29,18 @@ stream.on('tweet', function (tweet) {
if (tweet.user.screen_name === 'a__robot') {
var nameID = tweet.id_str;
var trumptweeturl = 'https://twitter.com/a__robot/status/' + nameID;
console.log(trumptweeturl);
var s = Screenshot(trumptweeturl).width(800).capture(function (err, img) {
if (err) throw err;
fs.writeFileSync(join('./pics/trump.png'), img);
console.log('saved to trump.png');
});
console.log(s);
ss_opt = {
url: trumptweeturl
outfile: './pics.trump.png'
}
await screenshot ss_opt, defer e,outfile
console.log e
console.log outfile
process.exit 0
var trumpmessages = session.object.trumpmessages;
var randomtrumpmessage = trumpmessages[Math.floor(Math.random() * trumpmessages.length)];
var b64content = fs.readFileSync('./pics/trump.png', { encoding: 'base64' })
@@ -54,6 +64,10 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
T.post('statuses/update', params, function (err, data, response) {
console.log("Replied to Trump's Tweet with " + randomtrumpmessage)
})
T.post('statuses/update', {status: randomtrumpmessage + ' ' + trumptweeturl}, function (err, data, response) {
console.log("Posted tweet with " + randomtrumpmessage)
})
}
}
})
})

View File

@@ -8,7 +8,9 @@
"Nope!",
"Donald Dump",
"Tronald Dump",
"Shut the FUCK up, Donny"
"Shut the FUCK up, Donny",
"Where's your damn tax returns",
"Quit now while you're behind"
],
"hillarymessages": [
"Release the Benghazi emails!",

View File

@@ -7,8 +7,9 @@
"fs": "^0.0.2",
"twit": "^2.2.4",
"lowdb": "^0.12.5",
"phantomjs-prebuilt": "^2.1.7",
"url-to-screenshot": "^0.6.1"
"url-screenshot": "^0.4.0",
"wegweg": "^0.9.0",
"phantomjs-prebuilt": "^2.1.7"
},
"devDependencies": {},
"scripts": {