<commit_before>'use strict';

const Discord = require('discord.js');
const Rollem  = require('./rollem.js');

var rollemClient = null;

function newClient() {
  let client = new Discord.Client();

  var token = process.env.DISCORD_BOT_USER_TOKEN

  var mentionRegex = /$<@999999999999999999>/i;
  var messageInterval = 60000;
  var restartMessage = "Hello, World!";
  var messages = [
    "http://rollem.rocks"
  ];

  function cycleMessage()
  {
    var message = messages.shift();
    messages.push(message);
  //   console.log('Set status to: ' + message);
    client.user.setStatus("online", message);
  }

  client.on('disconnect', () => {
    console.log(""+new Date()+" reconnecting");
    client.destroy();
    rollemClient = newClient();
    console.log(""+new Date()+" reconnected");
  });

  client.on('ready', () => {
    console.log('I am ready!');
    console.log('Set status to: ' + restartMessage);
    client.user.setStatus("online", restartMessage);
    console.log('username: ' + client.user.username);
    console.log('id: ' + client.user.id);
    setInterval(cycleMessage, messageInterval);
    var mentionRegex_s = '^<@' + client.user.id + '>\\s+';
    mentionRegex = new RegExp(mentionRegex_s);
  });

  client.on('message', message => {
    if (message.author.bot) { return; }
    if (message.author == client.user) { return; }
    if (message.guild) { return; }
    if (message.content === 'ping') {
      message.reply('pong');
    }
  });

  client.on('message', message => {
    if (message.author.bot) { return; }<commit_msg>kill the process on disconnect<commit_after>'use strict';

const Discord = require('discord.js');
const Rollem  = require('./rollem.js');

var rollemClient = null;

function newClient() {
  let client = new Discord.Client();

  var token = process.env.DISCORD_BOT_USER_TOKEN

  var mentionRegex = /$<@999999999999999999>/i;
  var messageInterval = 60000;
  var restartMessage = "Hello, World!";
  var messages = [
    "http://rollem.rocks"
  ];

  function cycleMessage()
  {
    var message = messages.shift();
    messages.push(message);
  //   console.log('Set status to: ' + message);
    client.user.setStatus("online", message);
  }

  client.on('disconnect', () => {
    console.log(""+new Date()+" quitting");
    process.exit();
  });

  client.on('ready', () => {
    console.log('I am ready!');
    console.log('Set status to: ' + restartMessage);
    client.user.setStatus("online", restartMessage);
    console.log('username: ' + client.user.username);
    console.log('id: ' + client.user.id);
    setInterval(cycleMessage, messageInterval);
    var mentionRegex_s = '^<@' + client.user.id + '>\\s+';
    mentionRegex = new RegExp(mentionRegex_s);
  });

  client.on('message', message => {
    if (message.author.bot) { return; }
    if (message.author == client.user) { return; }
    if (message.guild) { return; }
    if (message.content === 'ping') {
      message.reply('pong');
    }
  });

  client.on('message', message => {
    if (message.author.bot) { return; }
{'fraction_non_alphanumeric': 0.18026315789473685, 'fraction_numerical': 0.015131578947368421, 'mean_word_length': 3.472058823529412, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '1925992', 'n_tokens_mistral': 1039, 'n_tokens_neox': 988, 'n_words': 197}