<commit_before>const AbstractModule = require('./AbstractModule');

class GriffBot extends AbstractModule {
  getEvents() {
    return [
      {
        'key': 'message',
        'callback': message => {
          if (!this.isGriff(message.author)) {
            return;
          }
          this.archiveEvent('message', message);
        }
      },
      {
        'key': 'messageDelete',
        'callback': message => {
          if (!this.isGriff(message.author)) {
            return;
          }
          this.archiveEvent('messageDelete', message);
        }
      },
      {
        'key': 'messageDeleteBulk',
        'callback': messages => {
          messages.map(message => {
            if (!this.isGriff(message.author)) {
              return;
            }
            this.archiveEvent('messagesDeleteBulk', message);
          });
        }
      },
      {
        'key': 'messageUpdate',
        'callback': (oldMessage, newMessage) => {
          if (!this.isGriff(oldMessage.author)) {
            return;
          }
          this.archiveEvent('messageUpdate', newMessage);
        }
      }];
  }

  isGriff(obj) {
    return obj.id == process.env.GRIFF_ID;
  }

  archiveEvent(event, message) {
    var content = {
      event: event,
      message: {
        guild: {
          id: message.member.guild.id,
          name: message.member.guild.name
        },
        channel: {
          id: message.channel.id,
          name: message.channel.name
        },
        author: {
          id: message.author.id,
          name: message.author.username
        },
        id: message.id,
        type: message.type,
        time: message.editedTimestamp || message.createdTimestamp,
        content: message.content
      }
    };

    this.esClient.index({
      index: 'griffin',
      type: 'message',
      body: content
    }, (err, res) => console.log(err, res));
  }

  //TODO implement search on es index
  getEndpoints() {
    return {
      '/gSearch': (request, response) => response.send("Hello World!"),
    };
  }
}

module.exports = GriffBot;<commit_msg>Added tracking for another user.<commit_after>const AbstractModule = require('./AbstractModule');

class GriffBot extends AbstractModule {
  getEvents() {
    return [
      {
        'key': 'message',
        'callback': message => {
          if (!this.isGriff(message.author)) {
            return;
          }
          this.archiveEvent('message', message);
        }
      },
      {
        'key': 'messageDelete',
        'callback': message => {
          if (!this.isGriff(message.author)) {
            return;
          }
          this.archiveEvent('messageDelete', message);
        }
      },
      {
        'key': 'messageDeleteBulk',
        'callback': messages => {
          messages.map(message => {
            if (!this.isGriff(message.author)) {
              return;
            }
            this.archiveEvent('messagesDeleteBulk', message);
          });
        }
      },
      {
        'key': 'messageUpdate',
        'callback': (oldMessage, newMessage) => {
          if (!this.isGriff(oldMessage.author)) {
            return;
          }
          this.archiveEvent('messageUpdate', newMessage);
        }
      }];
  }

  isGriff(obj) {
    return obj.id == process.env.GRIFF_ID || obj.id == process.env.JOE_ID;
  }

  archiveEvent(event, message) {
    var content = {
      event: event,
      message: {
        guild: {
          id: message.member.guild.id,
          name: message.member.guild.name
        },
        channel: {
          id: message.channel.id,
          name: message.channel.name
        },
        author: {
          id: message.author.id,
          name: message.author.username
        },
        id: message.id,
        type: message.type,
        time: message.editedTimestamp || message.createdTimestamp,
        content: message.content
      }
    };

    this.esClient.index({
      index: 'griffin',
      type: 'message',
      body: content
    }, (err, res) => console.log(err, res));
  }

  //TODO implement search on es index
  getEndpoints() {
    return {
      '/gSearch': (request, response) => response.send("Hello World!"),
    };
  }
}

module.exports = GriffBot;
{'fraction_non_alphanumeric': 0.13321209365764947, 'fraction_numerical': 0.0, 'mean_word_length': 1.5157232704402517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '724891', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1212, 'n_words': 221}