mirror of
https://github.com/thewesker/bug-em.git
synced 2025-12-20 04:01:05 -05:00
lol
This commit is contained in:
22
config.json
Normal file
22
config.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"trumpmessages": [
|
||||
"Delete your account.",
|
||||
"Trump smells bad.",
|
||||
"You're gonna lose, cheeto monster!",
|
||||
"HAHAHAHAHAHA",
|
||||
"What a terrible tweet!",
|
||||
"Nope!",
|
||||
"Donald Dump",
|
||||
"Tronald Dump"
|
||||
]
|
||||
"hillarymessages": [
|
||||
"Release the Benghazi emails!",
|
||||
"Where are the emails, Hillary?",
|
||||
"Cillary Hlinton",
|
||||
"We're on to you, Hillary!"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"main": "test.js",
|
||||
"dependencies": {
|
||||
"fs": "^0.0.2",
|
||||
"twauth": "^1.0.1",
|
||||
"twit": "^2.2.4"
|
||||
"twit": "^2.2.4",
|
||||
"lowdb": "^0.12.5"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
|
||||
BIN
pics/hillary.gif
BIN
pics/hillary.gif
Binary file not shown.
|
Before Width: | Height: | Size: 830 KiB After Width: | Height: | Size: 1.2 MiB |
16
test.js
16
test.js
@@ -1,5 +1,8 @@
|
||||
var Twit = require('twit')
|
||||
var fs = require('fs')
|
||||
var low = require('lowdb');
|
||||
var storage = require('lowdb/file-sync');
|
||||
var session = low('./config.json', {'storage': storage});
|
||||
|
||||
var T = new Twit({
|
||||
consumer_key: 'XEpOzvNVnIL0z5cFggsZQzrTt',
|
||||
@@ -15,7 +18,9 @@ var stream = T.stream('statuses/filter', { follow: '25073877, 1339835893, 216776
|
||||
stream.on('tweet', function (tweet) {
|
||||
if (tweet.user.screen_name === 'realDonaldTrump') {
|
||||
var b64content = fs.readFileSync('./pics/trump.gif', { encoding: 'base64' })
|
||||
|
||||
var trumpmessages = session.object.trumpmessages;
|
||||
var randomtrumpmessage = trumpmessages[Math.floor(Math.random() * trumpmessages.length)];
|
||||
|
||||
// first we must post the media to Twitter
|
||||
T.post('media/upload', { media_data: b64content }, function (err, data, response) {
|
||||
// now we can assign alt text to the media, for use by screen readers and
|
||||
@@ -29,10 +34,10 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
|
||||
T.post('media/metadata/create', meta_params, function (err, data, response) {
|
||||
if (!err) {
|
||||
// now we can reference the media and post a tweet (media will attach to the tweet)
|
||||
var params = {in_reply_to_status_id: nameID, status: '@' + name + " Delete your account.", media_ids: [mediaIdStr] }
|
||||
var params = {in_reply_to_status_id: nameID, status: '@' + name + ' ' + randomtrumpmessage, media_ids: [mediaIdStr] }
|
||||
|
||||
T.post('statuses/update', params, function (err, data, response) {
|
||||
console.log("Replied to Trump's Tweet")
|
||||
console.log("Replied to Trump's Tweet with " + randomtrumpmessage)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -40,7 +45,8 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
|
||||
}
|
||||
if (tweet.user.screen_name === 'HillaryClinton') {
|
||||
var b64content = fs.readFileSync('./pics/hillary.gif', { encoding: 'base64' })
|
||||
|
||||
var hillarymessages = session.object.hillarymessages;
|
||||
var randomhillarymessage = hillarymessages[Math.floor(Math.random() * hillarymessages.length)];
|
||||
// first we must post the media to Twitter
|
||||
T.post('media/upload', { media_data: b64content }, function (err, data, response) {
|
||||
// now we can assign alt text to the media, for use by screen readers and
|
||||
@@ -57,7 +63,7 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
|
||||
var params = {in_reply_to_status_id: nameID, status: '@' + name + " Release the Benghazi emails!", media_ids: [mediaIdStr] }
|
||||
|
||||
T.post('statuses/update', params, function (err, data, response) {
|
||||
console.log("Replied to Hillary's Tweet")
|
||||
console.log("Replied to Hillary's Tweet with " + randomhillarymessage)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user