<commit_before>#!/usr/bin/env node

'use strict';

var Slack = require('slack-client');
var token = process.argv[2];

if (!token) {
  console.error([
    'Usage: feurbot <token>',
    null,
    'To generate a token, create a bot at http://my.slack.com/services/new/bot'
  ].join('\n'));
  process.exit(1);
}

var slack = new Slack(token);

slack.on('message', function (message) {
  if (message.type !== 'message') {
    return;
  }

  if (!/quoi\s*[?!]*$/.test(message.text) && Math.random() < 0.99) {
    return;
  }

  var channel = slack.getChannelGroupOrDMByID(message.channel);
  var before  = 'FEEEEEUUUUUUUR !';
  var after   = Math.random() < .5 ? '(bim !)' : '(boum !)';
  var msg     = channel.send(before);

  setTimeout(function() {
    msg.updateMessage(before + ' ' + after);
  }, 700);
});

slack.on('error', function (err) {
  if (err === 'invalid_auth') {
    console.error('Invalid token, go grab a valid one!')
    process.exit(1);
  }

  console.error(err);
});

slack.login();<commit_msg>Add some more trigger messages<commit_after>#!/usr/bin/env node

'use strict';

var Slack   = require('slack-client');
var token   = process.argv[2];
var trigger = /(q+u+o+i+|k+o+i+|k+o+a+|c+o+m+e+n+t+)\s*[?!]*$/;

if (!token) {
  console.error([
    'Usage: feurbot <token>',
    null,
    'To generate a token, create a bot at http://my.slack.com/services/new/bot'
  ].join('\n'));
  process.exit(1);
}

var slack = new Slack(token);

slack.on('message', function (message) {
  if (message.type !== 'message') {
    return;
  }

  if (!trigger.test(message.text) && Math.random() < 0.99) {
    return;
  }

  var channel = slack.getChannelGroupOrDMByID(message.channel);
  var before  = 'FEEEEEUUUUUUUR !';
  var after   = Math.random() < .5 ? '(bim !)' : '(boum !)';
  var msg     = channel.send(before);

  setTimeout(function() {
    msg.updateMessage(before + ' ' + after);
  }, 700);
});

slack.on('error', function (err) {
  if (err === 'invalid_auth') {
    console.error('Invalid token, go grab a valid one!')
    process.exit(1);
  }

  console.error(err);
});

slack.login();
{'fraction_non_alphanumeric': 0.20648545541249405, 'fraction_numerical': 0.009537434430138292, 'mean_word_length': 3.4168421052631577, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '1712771', 'n_tokens_mistral': 826, 'n_tokens_neox': 797, 'n_words': 164}