add image to walsh tweets

This commit is contained in:
thewesker
2016-10-04 16:24:59 -04:00
committed by GitHub
parent 48e494fa98
commit 4bd8e05826

4
app.js
View File

@@ -70,7 +70,7 @@ T.post('media/upload', { media_data: b64content }, function (err, data, response
}) })
} }
if (tweet.user.screen_name === 'WalshFreedom') { if (tweet.user.screen_name === 'WalshFreedom') {
var b64content = fs.readFileSync('./pics/hulk.gif', { encoding: 'base64' }) var b64content = fs.readFileSync('./pics/walsh.jpg', { encoding: 'base64' })
var hulkmessages = session.object.hulkmessages; var hulkmessages = session.object.hulkmessages;
var randomhulkmessage = hulkmessages[Math.floor(Math.random() * hulkmessages.length)]; var randomhulkmessage = hulkmessages[Math.floor(Math.random() * hulkmessages.length)];
// first we must post the media to Twitter // first we must post the media to Twitter
@@ -86,7 +86,7 @@ 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 + " pay your child support" } var params = {in_reply_to_status_id: nameID, status: '@' + name + " pay your child support", 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 Walsh's Tweet with " + randomhulkmessage) console.log("Replied to Walsh's Tweet with " + randomhulkmessage)