<commit_before>'use strict';

var Twit = require('twit'),
  request = require('request'),
  dotenv = require('dotenv'),
  redis = require('redis'),
  rClient = redis.createClient();

dotenv.load();

var mentionBot = (function() {
  var T = new Twit({
    consumer_key: process.env.CONSUMER_KEY,
    consumer_secret: process.env.CONSUMER_SECRET,
    access_token: process.env.ACCESS_TOKEN,
    access_token_secret: process.env.ACCESS_TOKEN_SECRET
  });

  var checkForReply = function(tweetId) {
    return new Promise(function(resolve, reject) {
      rClient.sismember('repliedTweets', tweetId, function(err, res) {
        if(err) { reject(err); }
        else { resolve((res === 1)); }
      });
    });
  };

  var postReply = function(isRepliedTo, tweetId, reply, username) {
    var that = this;
    return new Promise(function(resolve, reject) {
      if(isRepliedTo) { resolve(false); }

      var message = (username + ' ' + reply).slice(0,140);

      that.T.post('statuses/update', { status: message, in_reply_to_status_id: tweetId }, function(err, data, res) {
        if(err) { reject(err); }
        else { resolve(true); }
      });
    });
  };

  var saveToDataStore = function(wasPosted, tweet, reply) {
    return new Promise(function(resolve, reject) {
      if(!wasPosted) { resolve(false); }
      else {
        rClient.hmset(tweet.id, {<commit_msg>all wired up<commit_after>'use strict';

var Twit = require('twit'),
  request = require('request'),
  dotenv = require('dotenv'),
  redis = require('redis'),
  rClient = redis.createClient();

dotenv.load();

var mentionBot = (function() {
  var T = new Twit({
    consumer_key: process.env.CONSUMER_KEY,
    consumer_secret: process.env.CONSUMER_SECRET,
    access_token: process.env.ACCESS_TOKEN,
    access_token_secret: process.env.ACCESS_TOKEN_SECRET
  });

  var checkForReply = function(tweetId) {
    return new Promise(function(resolve, reject) {
      rClient.sismember('repliedTweets', tweetId, function(err, res) {
        if(err) { reject(err); }
        else { resolve((res === 1)); }
      });
    });
  };

  var postReply = function(isRepliedTo, tweetId, reply, username) {
    return new Promise(function(resolve, reject) {
      if(isRepliedTo) { resolve(false); }

      var message = (username + ' ' + reply).slice(0,140);

      T.post('statuses/update', { status: message, in_reply_to_status_id: tweetId }, function(err, data, res) {
        if(err) { reject(err); }
        else { resolve(true); }
      });
    });
  };

  var saveToDataStore = function(wasPosted, tweet, reply) {
    return new Promise(function(resolve, reject) {
      if(!wasPosted) { resolve(false); }
      else {
        rClient.hmset(tweet.id, {
{'fraction_non_alphanumeric': 0.14979757085020243, 'fraction_numerical': 0.00368052999631947, 'mean_word_length': 3.3980582524271843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '568212', 'n_tokens_mistral': 923, 'n_tokens_neox': 901, 'n_words': 177}