mirror of
https://github.com/thewesker/bug-em.git
synced 2025-12-20 12:11:05 -05:00
lol
This commit is contained in:
26
app.js
26
app.js
@@ -1,6 +1,11 @@
|
|||||||
var Twit = require('twit')
|
var Twit = require('twit')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
|
var screenshot = require('url-to-screenshot');
|
||||||
var low = require('lowdb');
|
var low = require('lowdb');
|
||||||
|
var path = require('path')
|
||||||
|
var childProcess = require('child_process')
|
||||||
|
var phantomjs = require('phantomjs-prebuilt')
|
||||||
|
var binPath = phantomjs.path
|
||||||
var storage = require('lowdb/file-sync');
|
var storage = require('lowdb/file-sync');
|
||||||
var session = low('./config.json', {'storage': storage});
|
var session = low('./config.json', {'storage': storage});
|
||||||
|
|
||||||
@@ -16,12 +21,23 @@ var T = new Twit({
|
|||||||
//
|
//
|
||||||
var stream = T.stream('statuses/filter', { follow: '25073877, 1339835893, 179932936, 6160792, 2853461537, 1214598626' })
|
var stream = T.stream('statuses/filter', { follow: '25073877, 1339835893, 179932936, 6160792, 2853461537, 1214598626' })
|
||||||
stream.on('tweet', function (tweet) {
|
stream.on('tweet', function (tweet) {
|
||||||
if (tweet.user.screen_name === 'AwfulJack') {
|
if (tweet.user.screen_name === 'a__robot') {
|
||||||
var trumpmessages = session.object.trump;
|
var nameID = tweet.id_str;
|
||||||
|
var trumptweeturl = { 'https://twitter.com/a__robot/status/' + nameID };
|
||||||
|
|
||||||
|
screenshot(trumptweeturl)
|
||||||
|
.width(500)
|
||||||
|
.height(500)
|
||||||
|
.clip()
|
||||||
|
.capture(function(err, img) {
|
||||||
|
if (err) throw err;
|
||||||
|
fs.writeFileSync(__dirname + '/pics/trump.png', img);
|
||||||
|
console.log('screenshot saved as trump.png');
|
||||||
|
});
|
||||||
|
|
||||||
|
var trumpmessages = session.object.trumpmessages;
|
||||||
var randomtrumpmessage = trumpmessages[Math.floor(Math.random() * trumpmessages.length)];
|
var randomtrumpmessage = trumpmessages[Math.floor(Math.random() * trumpmessages.length)];
|
||||||
var trumpmessage = randomtrumpmessage.map('message');
|
var b64content = fs.readFileSync('./pics/trump.png', { encoding: 'base64' })
|
||||||
var trumpgif = randomtrumpmessage.map('gif');
|
|
||||||
var b64content = fs.readFileSync(trumpgif, { encoding: 'base64' })
|
|
||||||
|
|
||||||
|
|
||||||
// first we must post the media to Twitter
|
// first we must post the media to Twitter
|
||||||
|
|||||||
48
config.json
48
config.json
@@ -1,42 +1,14 @@
|
|||||||
{
|
{
|
||||||
"trump": [
|
"trumpmessages": [
|
||||||
{
|
"Delete your account.",
|
||||||
"message": "Delete your account.",
|
"Trump smells bad.",
|
||||||
"gif": "./pics/trump.gif"
|
"You're gonna lose, cheeto monster!",
|
||||||
},
|
"HAHAHAHAHAHA",
|
||||||
{
|
"What a terrible tweet!",
|
||||||
"message": "Trump smells bad.",
|
"Nope!",
|
||||||
"gif": "./pics/trump.gif"
|
"Donald Dump",
|
||||||
},
|
"Tronald Dump",
|
||||||
{
|
"Shut the FUCK up, Donny"
|
||||||
"message": "You're gonna lose, cheeto monster!",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "HAHAHAHAHAHA",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "What a terrible tweet!",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "Nope!",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "Donald Dump",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "Tronald Dump",
|
|
||||||
"gif": "./pics/trump.gif"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "Shut the FUCK up, Donny",
|
|
||||||
"gif": "./pics/donny.gif"
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
],
|
||||||
"hillarymessages": [
|
"hillarymessages": [
|
||||||
"Release the Benghazi emails!",
|
"Release the Benghazi emails!",
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs": "^0.0.2",
|
"fs": "^0.0.2",
|
||||||
"twit": "^2.2.4",
|
"twit": "^2.2.4",
|
||||||
"lowdb": "^0.12.5"
|
"lowdb": "^0.12.5",
|
||||||
|
"phantomjs-prebuilt": "^2.1.7",
|
||||||
|
"url-to-screenshot": "^0.6.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user