<commit_before>module.exports = {
  '{USER}': function(user, cb) {
    var self = this;
    if (!self.config || !self.config.welcome) return;

    // simulate a real user delay
    setTimeout(function() {
      var knownUser = ~Object.keys(self.userMap).indexOf(user.id);
      if (!knownUser) {
        self.__rpc('im.open', {
          user: user.id
        }, function(err, response) {
          if (!response || !response.channel || !response.channel.id) {
            return console.error('Invalid response:', err, response);
          }

          if (self.config.welcome instanceof Array) {
            var timing = 0;
            var spacing = 15000;
            self.config.welcome.forEach(function(message) {
              setTimeout(function() {
                self.__say(response.channel.id, formatText(message));
              }, timing);
              timing += spacing;
            });
          } else {
            self.__say(response.channel.id, self.config.welcome);
          }
        });

      }
    }, 1000);

    function formatText(input) {
      for (var id in self.channelMap) {
        var channel = self.channelMap[id];
        input = input.replace('{{channel:'+channel.name+'}}', '<#'+id+'>');
      }
      for (var id in self.userMap) {
        var channel = self.userMap[id];
        input = input.replace('{{channel:'+channel.name+'}}', '<#'+id+'>');
      }
      input = input.replace('{{user}}', '<@'+user.id+'>');<commit_msg>Use new snarl plugin feature instead of emulating / waiting.<commit_after>module.exports = {
  '{USER:NEW}': function(message, cb) {
    var self = this;
    if (!self.config || !self.config.welcome) return;

    var user = message.user;

    self.__rpc('im.open', {
      user: user.id
    }, function(err, response) {
      if (!response || !response.channel || !response.channel.id) {
        return console.error('Invalid response:', err, response);
      }

      if (self.config.welcome instanceof Array) {
        var timing = 15000; // start timing (send first message 15 seconds in)
        var spacing = 15000; // interval between messages
        self.config.welcome.forEach(function(message) {
          setTimeout(function() {
            self.__say(response.channel.id, formatText(message));
          }, timing);
          timing += spacing;
        });
      } else {
        self.__say(response.channel.id, formatText(self.config.welcome));
      }
    });

    function formatText(input) {
      for (var id in self.channelMap) {
        var channel = self.channelMap[id];
        input = input.replace('{{channel:'+channel.name+'}}', '<#'+id+'>');
      }
      for (var id in self.userMap) {
        var user = self.userMap[id];
        input = input.replace('{{user:'+user.name+'}}', '<#'+id+'>');
      }
      input = input.replace('{{user}}', '<@'+user.id+'>');
{'fraction_non_alphanumeric': 0.16695896176780078, 'fraction_numerical': 0.007716590669940372, 'mean_word_length': 2.233560090702948, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '269602', 'n_tokens_mistral': 858, 'n_tokens_neox': 835, 'n_words': 177}