<commit_before>var irc = require('irc');
var swig = require('swig');
var email = require("emailjs");

var isHeroku = !!process.env["MANDRILL_USERNAME"];
if (isHeroku) {
  var server = email.server.connect({
    user: process.env["MANDRILL_USERNAME"],
    password: process.env["<PASSWORD>"],
    host: "smtp.mandrillapp.com",
    ssl: true,
    domain: "heroku.com"
  });
}

var channelName = "#biojs";

var client = new irc.Client('irc.freenode.net', 'biojs-registry', {
  userName: "biojs-registry",
  secure: true,
  port: 7000,
  showError: false,
  debug: false,
  floodProtection: true,
  floodProtectionDelay: 500,
  channels: [channelName]
});

client.addListener("error", function() {});

module.exports = function(opts) {
  var evt = opts.evt;
  var log = opts.log;

  client.join(channelName, function() {
    client.connected = true;
    log.info("joined irc channel");
  });

  function speak(text) {
    if (client.connected) {
      client.say(channelName, text);
    }
  }

  var newPkgMail = swig.compileFile(__dirname + '/templates/mails/new_package.tpl');

  evt.on("pkg:new", function(pkg) {
    var msg = "BioJS got a new package: " + pkg.name;
    if (pkg.author && pkg.author.name) {
      msg += " by @" + pkg.author.name;
    }
    speak(msg);

    if (pkg.author && pkg.author.email != undefined) {
      log.info("sending new pkg mail for " + pkg.name);
      server.send({
        from: "BioJS registry <<EMAIL>>",
        to: pkg.author.name + "<" + pkg.author.email + ">",
        bcc: "greenify <<EMAIL>>",
        subject: "BioJS registry:" + pkg.name + " published",
        text: newPkgMail({
          author: pkg.author.name,
          url: "http://biojs.io/" + pkg.name,
          name: pkg.name
        })
      }, function(err, message) {
        if (err) {
          log.warn(err);
        }
      });
    }
  });
  evt.on("pkg:updated", function(pkg) {
    var text = "BioJS package update " + pkg.name + " to " + pkg.version;
    if (pkg.author && pkg.author.name) {
      text += " by @" + pkg.author.name;
    }
    speak(text);
  });
};
<commit_msg>updated irc notification text<commit_after>var irc = require('irc');
var swig = require('swig');
var email = require("emailjs");

var isHeroku = !!process.env["MANDRILL_USERNAME"];
if (isHeroku) {
  var server = email.server.connect({
    user: process.env["MANDRILL_USERNAME"],
    password: <PASSWORD>["<PASSWORD>"],
    host: "smtp.mandrillapp.com",
    ssl: true,
    domain: "heroku.com"
  });
}

var channelName = "#biojs";

var client = new irc.Client('irc.freenode.net', 'biojs-registry', {
  userName: "biojs-registry",
  secure: true,
  port: 7000,
  showError: false,
  debug: false,
  floodProtection: true,
  floodProtectionDelay: 500,
  channels: [channelName]
});

client.addListener("error", function() {});

module.exports = function(opts) {
  var evt = opts.evt;
  var log = opts.log;

  client.join(channelName, function() {
    client.connected = true;
    log.info("joined irc channel");
  });

  function speak(text) {
    if (client.connected) {
      client.say(channelName, text);
    }
  }

  var newPkgMail = swig.compileFile(__dirname + '/templates/mails/new_package.tpl');

  evt.on("pkg:new", function(pkg) {
    var msg = "BioJS got a new package: " + pkg.name;
    if (pkg.author && pkg.author.name) {
      msg += " by @" + pkg.author.name;
    }
    speak(msg);

    if (pkg.author && pkg.author.email != undefined) {
      log.info("sending new pkg mail for " + pkg.name);
      server.send({
        from: "BioJS registry <<EMAIL>>",
        to: pkg.author.name + "<" + pkg.author.email + ">",
        bcc: "greenify <<EMAIL>>",
        subject: "BioJS registry:" + pkg.name + " published",
        text: newPkgMail({
          author: pkg.author.name,
          url: "http://biojs.io/" + pkg.name,
          name: pkg.name
        })
      }, function(err, message) {
        if (err) {
          log.warn(err);
        }
      });
    }
  });
  evt.on("pkg:updated", function(pkg) {
    var text = "BioJS package update: " + pkg.name + " to " + pkg.version;
    if (pkg.author && pkg.author.name) {
      text += " by @" + pkg.author.name;
    }
    speak(text);
  });
};

{'fraction_non_alphanumeric': 0.17411988582302568, 'fraction_numerical': 0.003330161750713606, 'mean_word_length': 2.717948717948718, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '2683529', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1462, 'n_words': 307}