<commit_before>var Task = require('../models/task');
var taskUtils = require('./task-utils');
var tu;
var terms = ['inktober'];
// <NAME> = 13205002
var canRetweetAlways = ['13205002'];
var lastRetweets = [];
var now = new Date();
var startDate = Date.UTC(now.getFullYear(), 8, 30);
var endDate = Date.UTC(now.getFullYear(), 10, 1);


// only keep the values for the last hour
setInterval(function () {
  var now = Date.now() - 60 * 60 * 1000;
  lastRetweets = lastRetweets.filter(function (val) { return val >= now; });
}, 1000);

module.exports.init = function (plugin) {
  tu = require('tuiter')(plugin.app.config.twitter);

  function onReTweet(err) {
    if (err) {
        console.error("retweeting failed :(");
        console.error(err);
    }
  }

  function onTweet(tweet) {
    // if it's flagged as a retweet or has RT
    // in there then we probably don't want
    // to retweet it again.
    if (tweet.retweeted) {
        return;
    }
    if (tweet.text.indexOf("RT") !== -1) {
        return;
    }
    var txt = tweet.text.toLowerCase();
    if (terms.indexOf(txt) !== -1) {
      return;
    }

    var date = null;
    try {
      date = Date.parse(tweet.created_at);
    } catch (e) {

    }
    if ((canRetweetAlways.indexOf(tweet.id_str) !== -1) || (date && date <= endDate && date >= startDate)) {
      lastRetweets.push(Date.now());
      // console.log("Retweeting: " + tweet.text);
      // note we're using the id_str property since<commit_msg>only retweet things with a http in<commit_after>var Task = require('../models/task');
var taskUtils = require('./task-utils');
var tu;
var terms = ['inktober'];
// jake parker = 13205002
var canRetweetAlways = ['13205002'];
var lastRetweets = [];
var now = new Date();
var startDate = Date.UTC(now.getFullYear(), 8, 30);
var endDate = Date.UTC(now.getFullYear(), 10, 1);


// only keep the values for the last hour
setInterval(function () {
  var now = Date.now() - 60 * 60 * 1000;
  lastRetweets = lastRetweets.filter(function (val) { return val >= now; });
}, 1000);

module.exports.init = function (plugin) {
  tu = require('tuiter')(plugin.app.config.twitter);

  function onReTweet(err) {
    if (err) {
        console.error("retweeting failed :(");
        console.error(err);
    }
  }

  function onTweet(tweet) {
    // if it's flagged as a retweet or has RT
    // in there then we probably don't want
    // to retweet it again.
    if (tweet.retweeted) {
        return;
    }
    if (tweet.text.indexOf("RT") !== -1) {
        return;
    }
    var txt = tweet.text.toLowerCase();
    if (terms.indexOf(txt) !== -1) {
      return;
    }

    var date = null;
    try {
      date = Date.parse(tweet.created_at);
    } catch (e) {

    }
    if ((txt.indexOf('http') !== -1) && ((canRetweetAlways.indexOf(tweet.id_str) !== -1) || (date && date <= endDate && date >= startDate))) {
      lastRetweets.push(Date.now());
      // console.log("Retweeting: " + tweet.text);
      // note we're using the id_str property since
{'fraction_non_alphanumeric': 0.16788563829787234, 'fraction_numerical': 0.024933510638297872, 'mean_word_length': 2.7896725440806045, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '5235960', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1016, 'n_words': 264}