Example #1
0
	fs.readFile('faceswap2/usednames.txt', function(err, f){
	    postnames = f.toString().split('\n');
	    var id = data.media_id_string;
		var tweet = {
			status: 'Hey @'+postnames[0]+' @'+postnames[1]+' we mixed your DNA. This is what your #selfiebabie looks like!',
			// status: 'We mixed your DNA. This is what your #selfiebabie looks like.',
			media_ids: [id]
		}
		T.post('statuses/update', tweet, tweeted);
	});
 function tweet( text ) {
     T.post( 'statuses/update', { status: text }, function( err, data, response ) {
         if( err ) {
             console.log( err );
         } else {
             logTranslation( data[ "text" ] );
             console.log( data[ "text" ] );
         }
     });
 };
Example #3
0
function postStatusUpdate(status, tweet) {
    twitter.post('statuses/update', { status: status, in_reply_to_status_id: tweet.id_str }, function (err, data, response) {
    //console.log("status: "+ status)
        if (err) {
            console.log(err);
        } else {
            console.log(data);
        }
    });
}
Example #4
0
 global.retweet = function(id, token, tsecret, cb){
   var auth = require(process.cwd()+'/config.json');
   if(token && tsecret){
     auth.access_token = token; auth.access_token_secret = tsecret;
   }
   var T = new Twit(auth);
   T.post('statuses/retweet/:id', { id: id }, function (err, data, response) {
     (cb || console.log.bind(console))(data);
   })  
 }
T.post('media/upload', { media: b64content }, function (err, data, response) {

  // now we can reference the media and post a tweet (media will attach to the tweet)
  var mediaIdStr = data.media_id_string
  var params = { status: 'loving life #nofilter', media_ids: [mediaIdStr] }

  T.post('statuses/update', params, function (err, data, response) {
    console.log(data)
  })
})
Example #6
0
  function(data) {

        output = "The limits of my" + " " + data[0].word + " " + "mean the limits of my" + " " + data[1].word + ".";
        statement = output;
        console.log(statement);
        T.post('statuses/update', { status: statement}, function(err, reply) {
          console.log("error: " + err);
          console.log("reply: " + reply);
        });
      }    
Example #7
0
		  translate(reply[0].text, function(trans) {
		    //remove @ symbols from translated text (prevents mentions/other peoples aggravation with my bot)
        trans = trans.replace(/@/g, '');
        //if the translated tweet is larger than the maximum length, cut off the end
        if (trans.length > 140)
          trans = trans.substr(0,140);
        console.log('new_status: ', trans);
        T.post('statuses/update', {status : trans}, function(err, reply) {
        });
      });
Example #8
0
var shameUser = function(screenName) {
  var tweet = '@' + screenName + ': You should have written \"should have\", not \"should of\".';
  console.log('Tweeting:', tweet);

  Bot.post('statuses/update', { status: tweet }, function(err, data, response) {
    if (err) {
      console.log('Error while sending tweet:', err);
    }
  });
}
Example #9
0
function retweet(retweetId) {
    T.post("statuses/retweet/" + retweetId, { }, function (err, response) {
        if (response) {
            console.log("Retweeted Tweet ID: " + retweetId);
        }
        if (err) {
            console.log("Retweet Error: ".error, err);
        }
    });
}
Example #10
0
(async function publishRates() {
  const rates = await report("rates");
  const constructTweet = rates;
  try {
    const tweetUpdate = await Tweet.post('statuses/update', { status: constructTweet });
    console.log(tweetUpdate.data.created_at);
  } catch (e) {
    console.log(e, "error occured posting tweet update");
  }
}());
Example #11
0
stream.on('tweet', function (tweet) {
  var statusUpdate = 'Hey ' + '@' + tweet.user.screen_name + ' check out http://bit.ly/15gj3x9';
   T.post('statuses/update', { status: statusUpdate }, function(err, reply) {
    if (err) {
        console.dir(err);
    } else {
        console.dir(reply);
    }
   });
});
Example #12
0
	  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 = { status: 'Bagels brought to you by #SolesBagelBot', media_ids: [mediaIdStr] }

	      T.post('statuses/update', params, function (err, data, response) {
	        console.log(data)
	      })
	    }
	  })
function autoRetweet(tweet) {
    twit.post('statuses/retweet/' + tweet.id_str, {}, function(err, data) {
        if (err) {
            console.log('Error' + err);
            //console.log(response);
        } else {
            console.log('Retweeted!');
        }
    });
}
Example #14
0
const tweetWaffleStatus = (status) => {
  twit.post('statuses/update', { status }, function(err, data, response) {
    if (err) {
      console.log(err)
    }
    else {
      console.log(data.entities.user_mentions[0].screen_name)
    }
  });
}
Example #15
0
function newTweet(status) {
  var status = status;
  T.post('statuses/update', { status: status }, function(err, data, response) {
    if (err) {
      console.log(err);
    } else {
      console.log(data);
    }
  });
}
 parseString(xml, function(err, result) {
   if (typeof(result.Data) != "undefined") {
     game = result.Data.Game[0].GameTitle[0] + " Holmes";
     console.log(game);
     T.post('statuses/update', { status: game}, function(err, reply) {
       console.log("error: " + err);
       console.log("reply: " + reply);
     });
   }
 });
Example #17
0
exports.postToTwitter = function(memoirTitle){
    
    console.log("Posting title: " + memoirTitle);
    T.post('statuses/update', { status: memoirTitle }, function(error, response){
        if(error)
            console.log("Error posting memoir title to twitter " + error);
        if(response)
            console.log("Successfully posted " + memoirTitle + " to Twitter");
    });
}
Example #18
0
function reply(mentionTargetUser, mentionTargetId, callback){
  var message = generateReplyMessage();

  twitter.post(TWITTER_TWIT_API,
    {
      status: '@' + mentionTargetUser + ' ' + message.message + ' ' + message.imageUrl,
      in_reply_to_status_id: mentionTargetId
    },
    callback);
}
Example #19
0
    function uploaded(err, data, response) {
      var id = data.media_id_string;
      var tweet = { //any metadata for the tweet
        status: '#codingrainbow live from node.js',
        media_ids: [id]
      }

      T.post('statuses/update', tweet, tweeted); //at the end of the upload function, we call the post function.

    }
Example #20
0
 pinoccioAPI.rest({url:'/v1/27/2/command', method:'post', data:{command: command}}, function(err, res){
   if (res) {
     var reply = res.reply.trim();
     if (reply === '') reply = '✔';
     reply = '@'+tweet.user.screen_name+' '+reply;
     twitter.post('statuses/update', {status: reply, in_reply_to_status_id:tweet.id}, function(err, data, res){
       console.log(err || 'replied with "'+reply+'"');
     })
   };
 });
Example #21
0
 setTimeout(function() {
   t.post('statuses/update',
     { 
       status: '@'+username+' '+replyText,
       in_reply_to_status_id: tweetID
     },
     function(err, data, response) {
       if(err) throw err;
     });
 }, getRandomInt(30000, 900000)); // wait anywhere from 30secs to 15mins
Example #22
0
File: anon.js Project: edsu/anon
    takeScreenshot(edit.url).then(function(screenshot) {

      // Mastodon
      if (account.mastodon) {
        const mastodon = new Mastodon(account.mastodon)
        mastodon.post('media', {file: fs.createReadStream(screenshot)})
          .then(function(response) {
            if (!response.data.id) {
              console.log('error uploading screenshot to mastodon')
              return
            }
            mastodon.post('statuses', { 'status': status, media_ids: [response.data.id] }, function(err) {
              if (err) {
                console.log(err)
              }
            })
        })
      }

      // Twitter
      if (account.access_token) {
        const twitter = new Twit(account)
        const b64content = fs.readFileSync(screenshot, {encoding: 'base64'})

        // upload the screenshot to twitter
        twitter.post('media/upload', {media_data: b64content}, function(err, data, response) {
          if (err) {
            console.log(err)
            return
          }

          // add alt text for the media, for use by screen readers
          const mediaIdStr = data.media_id_string
          const altText = "Screenshot of edit to " + edit.page
          const metaParams = {media_id: mediaIdStr, alt_text: {text: altText}}

          twitter.post('media/metadata/create', metaParams, function(err, data, response) {
            if (err) {
              console.log('metadata upload for twitter screenshot alt text failed with error', err)
            }
            const params = {
              'status': status,
              'media_ids': [mediaIdStr]
            }
            twitter.post('statuses/update', params, function(err) {
              if (err) {
                console.log(err)
              }
            })
            fs.unlinkSync(screenshot)
          })
        })
      }

    })
Example #23
0
		 function (error, stdout, stderr) {
		     console.log('stdout: ' + stdout);
		     console.log('stderr: ' + stderr);
		     if (error !== null) {
			 console.log('exec error: ' + error);
		     }

		     T.post('statuses/update', { status: '' + stdout }, function(err, data, response) {
			 console.log(data)
		     })
		 });
Example #24
0
f00bert.prototype.horsePatrickCheck = function (context, text) {
	if (!isPatrick(context)) {
		return;
	}

	Horse_patrick.post("statuses/update", {
		status : text
	}, function (err, reply) {
		console.log(err, reply);
	}.bind(this));
};
Example #25
0
 api.reqMgmtCmd(config.nodeRI, config.command, cmd, function(err,data){
   var reply = {};
   if(err) {
     reply = { status : 'ThingPlug Error :'+err };
   }
   else {
     reply = { status : 'Send Control Message to Device:'+config.nodeID };
   }
   T.post('statuses/update', reply, function (err, data, response) {
   });
 });
Example #26
0
	            T.post('media/upload', {media_data: crosses[r] }, uploaded); //'uploaded' callback for when the image data is uploaded but not posted yet 
							
                                      //data will have a numeric id for image to be uploaded 
		      function uploaded (err, data, reponse){ //this is where I will tweet! 
				    var id = data.media_id_string;
                                //params
				    var tweet = {
					   status: 'cross test', 
					
					   media_ids: [id] //you can have more than one image ID linked with a tweet 
				    }
                                                        //params
				    T.post ('statuses/update', tweet, tweeted);		
		      }
Example #27
0
File: bot.js Project: MarcL/iotbot
            this.twit.get('friends/ids', { user_id: randomFollower }, (error, reply) => {
                if (error) {
                    return callback(error);
                }
                
                const friends = reply.ids;
                const targetFollowerId = randomIndex(friends);

                // TODO: Check if already following and early out
                this.twit.post('friendships/create', { id: targetFollowerId }, callback); 
            });
Example #28
0
function tweetResponse(response, tweet) {
  if (process.env.ENVIRONMENT !== 'PRODUCTION') {
    return console.log('Would have tweeted:', response);
  }

  T.post('statuses/update', {status: response, in_reply_to_status_id: tweet.id_str}, function(err, data, response) {
    if (err) {
      console.error(err);
    }
  });
}
Example #29
0
function tweet(name, link, locale) {
  var tweetString = 'Head\'s up! ' + name + ' is now in stock on the ' + locale + ' store! #amiibo ' + link;

  T.post('statuses/update', { status: tweetString }, function callback(err, data, response) {
    if (err) {
      console.log(err);
    } else {
      console.log(data);
    }
  });
}
Example #30
0
            res.on('end', function() {
 
                data = data.join('');
 
                var reddit = JSON.parse(data).data.children,
                    len = reddit.length;
 
                // Limit top 15
                if(len > 15) {
                    len = 15;
                }
 
 
                // Loop through results and parse
                for(var j=0;j<len;j++) {

                    var ar = reddit[j].data,
                        score = ar.score,
                        created = ar.created,
                        title = ar.title,
                        url = ar.url,
                        domain = ar.domain,
                        id = ar.id;
                    

                    if(!tweeted[id] && (domain == "imgur.com" || domain=="youtube.com" || domain=="media.indiedb.com" || domain=="pixeljoint.com" || domain=="i.imgur.com") && created>load_time){
                    // Send tweet
                    title = shortenTweet(title);
                    
                    //Get the image from imgur
                    if(domain == "imgur.com"){
                        url = url.replace(/^https?:\/\//,'');
                        url = url.split('/');
                        newUrl = url[0]+'/gallery/'+url[1];
                        url = newUrl;
                        console.log('NEW URL '+url);

                    }

                    console.log([title, ' Url: ', url, ' '].join(''));
                    //twit
                   twit.post('statuses/update', {status: [title, ' ', url, ' #pixelArt'].join('')}, function(err, data, response){
                        console.log(data);
                    });


                    

                    tweeted.push(id);
                }(ar);
                    
                }
 
            });