<commit_before>#!/usr/bin/env node
const fs = require('fs');
const schedule = require('node-schedule');
const RtmClient = require('@slack/client').RtmClient;
const WebClient = require('@slack/client').WebClient;
const CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;

const config = require('./config.json');
const reminders = require('./reminders.json');

/**
 * Arianna - Zero Daedalus Slackbot
 * @module  arianna
 */

console.log('Arianna Running...');

const token = config.SLACK_TOKEN || '';
const rtm = new RtmClient(token);
const web = new WebClient(token);

rtm.on(CLIENT_EVENTS.RTM.AUTHENTICATED, (data) => {
  console.log(`Logged in as ${data.self.name} of team ${data.team.name}, but not yet connected to a channel`);
});

rtm.on(CLIENT_EVENTS.RTM.RTM_CONNECTION_OPENED, () => {
  rtm.sendMessage('Back online...', config.SLACK_CHANNEL);
  reminder();
  quote();
});

// Schedule Repeated Tasks
schedule.scheduleJob('0 */7 * * *', reminder);
schedule.scheduleJob('0 10 * * *', quote);

// Watch Slack
rtm.start();

// Handle Exits
process.on('SIGINT', handleExit);

/**
 * Functions
 */

// Send a personalized motivational reminder to me
function reminder() {
  const day = (new Date()).getDay();

  rtm.sendMessage(reminders.messages[day], reminders.channel); 
}

// Posts a random quote from the quotes file
function quote() {
  fs.readFile('quotes.txt', 'utf8', (err, data) => {
    if (err) {
      console.log(err);
    } else {
      const lines = data.split('\n');
      const rand = Math.floor(Math.random() * lines.length);

      const quote = lines[rand].match(/".+"/g)[0].slice(1, -1);
      rtm.sendMessage(`> *_${quote}_*`, config.SLACK_CHANNEL);
    }
  });
}

// Alerts the channel that the bot is down.
function handleExit() {
  web.chat.postMessage(config.SLACK_CHANNEL, 'Going offline...', { as_user: true }, (err) => {
    process.exit(err ? 1 : 0);
  });
}<commit_msg>Pull changes for release bump<commit_after>#!/usr/bin/env node
const fs = require('fs');
const schedule = require('node-schedule');
const RtmClient = require('@slack/client').RtmClient;
const WebClient = require('@slack/client').WebClient;
const CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS;

const config = require('./config.json');
const reminders = require('./reminders.json');

/**
 * Arianna - Zero Daedalus Slackbot
 * @module  arianna
 */

console.log('Arianna Running...');

const token = config.SLACK_TOKEN || '';
const rtm = new RtmClient(token);
const web = new WebClient(token);

rtm.on(CLIENT_EVENTS.RTM.AUTHENTICATED, (data) => {
  console.log(`Logged in as ${data.self.name} of team ${data.team.name}, but not yet connected to a channel`);
});

rtm.on(CLIENT_EVENTS.RTM.RTM_CONNECTION_OPENED, () => {
  rtm.sendMessage('Back online...', config.SLACK_CHANNEL);
});

// Schedule Repeated Tasks
schedule.scheduleJob('0 */4 * * *', reminder);
schedule.scheduleJob('0 10 * * *', quote);

// Watch Slack
rtm.start();

// Handle Exits
process.on('exit', handleExit);

/**
 * Functions
 */

// Send a personalized motivational reminder to me
function reminder() {
  const day = (new Date()).getDay();

  rtm.sendMessage(reminders.messages[day], reminders.channel); 
}

// Posts a random quote from the quotes file
function quote() {
  fs.readFile('quotes.txt', 'utf8', (err, data) => {
    if (err) {
      console.log(err);
    } else {
      const lines = data.split('\n');
      const rand = Math.floor(Math.random() * lines.length);

      const quote = lines[rand].match(/".+"/g)[0].slice(1, -1);
      rtm.sendMessage(`> *_${quote}_*`, config.SLACK_CHANNEL);
    }
  });
}

// Alerts the channel that the bot is down.
function handleExit() {
  web.chat.postMessage(config.SLACK_CHANNEL, 'Going offline...', { as_user: true }, () => {
    console.log('Goodbye!');
  });
}
{'fraction_non_alphanumeric': 0.18279852709100475, 'fraction_numerical': 0.0052603892688058915, 'mean_word_length': 3.9712418300653596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2506421', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1278, 'n_words': 293}