Removed Hillary, Hulk, and the baseball wayne guy

Also added blues_traveler
This commit is contained in:
thewesker
2016-09-20 21:17:36 -04:00
committed by GitHub
parent 8ae5ca586a
commit d1fb4fc64f

14
app.js
View File

@@ -15,7 +15,7 @@ var T = new Twit({
// filter the public stream by english tweets containing `#apple` // filter the public stream by english tweets containing `#apple`
// //
var stream = T.stream('statuses/filter', { follow: '25073877, 1339835893, 179932936, 172933437' }) var stream = T.stream('statuses/filter', { follow: '25073877, 31176345' })
stream.on('tweet', function (tweet) { stream.on('tweet', function (tweet) {
if (tweet.user.screen_name === 'realDonaldTrump') { if (tweet.user.screen_name === 'realDonaldTrump') {
var b64content = fs.readFileSync('./pics/trump.gif', { encoding: 'base64' }) var b64content = fs.readFileSync('./pics/trump.gif', { encoding: 'base64' })
@@ -43,10 +43,10 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
}) })
}) })
} }
if (tweet.user.screen_name === 'HillaryClinton') { if (tweet.user.screen_name === 'blues_traveler') {
var b64content = fs.readFileSync('./pics/hillary.gif', { encoding: 'base64' }) var b64content = fs.readFileSync('./pics/popper.gif', { encoding: 'base64' })
var hillarymessages = session.object.hillarymessages; var poppermessages = session.object.poppermessages;
var randomhillarymessage = hillarymessages[Math.floor(Math.random() * hillarymessages.length)]; var randompoppermessage = poppermessages[Math.floor(Math.random() * poppermessages.length)];
// first we must post the media to Twitter // first we must post the media to Twitter
T.post('media/upload', { media_data: b64content }, function (err, data, response) { 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 // now we can assign alt text to the media, for use by screen readers and
@@ -60,10 +60,10 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
T.post('media/metadata/create', meta_params, function (err, data, response) { T.post('media/metadata/create', meta_params, function (err, data, response) {
if (!err) { if (!err) {
// now we can reference the media and post a tweet (media will attach to the tweet) // 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 + " " + randomhillarymessage, media_ids: [mediaIdStr] } var params = {in_reply_to_status_id: nameID, status: '@' + name + " " + randompoppermessage, media_ids: [mediaIdStr] }
T.post('statuses/update', params, function (err, data, response) { T.post('statuses/update', params, function (err, data, response) {
console.log("Replied to Hillary's Tweet with " + randomhillarymessage) console.log("Replied to Pooper's Tweet with " + randompoppermessage)
}) })
} }
}) })