<commit_before>/*
  A ping pong bot, whenever you send "ping", it replies "pong".
*/

// Import the discord.js module
const DISCORD = require("discord.js");
const EXECFILE = require("child_process").execFile;
const FS = require('fs');
const SLTS = require('./slots');
const EVENTS = require('./events');
const UTIL = require('./util');
// Create an instance of a Discord CLIENT
const CLIENT = new DISCORD.Client();

// The TOKEN of your bot - https://discordapp.com/developers/applications/me
const TOKEN = '<KEY>';

// The ready event is vital, it means that your bot will only start reacting to information
// from Discord _after_ ready is emitted
CLIENT.on('ready', () => {
  console.log('I am ready!');
});

// Create an event listener for messages
CLIENT.on('message', message => {

  function slots(amount) {
    var path = '/tmp/' + message.author.id + '.json';
    if (FS.existsSync(path) == false) {
      UTIL.addCoins(message);
    }
    var readFile = FS.readFile(path,'utf8', function(err){
      if (err) {
        return console.log(err);
              }
    });
    var obj = JSON.parse(readFile);

    if (SLTS.checkrequirements(obj, amount)) {
      console.log(amount[2]);
      obj.coins = Number(obj.coins) + sendSlotResults(SLTS.slotsLogic(SLTS.genSlotsNumbers(), Number(amount[2]), amount[1].toLowerCase()));
      FS.writeFile(path, JSON.stringify(obj), function(err){
        if (err) {
          return console.log(err);
                }
      });
    } else {
      console.log(obj.coins);
      message.channel.send("You don't have enough coins to play slots");
    }
  }
  // Handles the display of the slots results
  function sendSlotResults(all) {
    message.channel.send('   S   L   O   T   S   ');
    all.slotRows = SLTS.changeNrToEmo(all.slotRows);
    message.channel.send(all.slotRows[0] + ' ' + all.slotRows[1] + ' ' + all.slotRows[2] + '\n' + all.slotRows[3] + ' ' + all.slotRows[4] + ' ' + all.slotRows[5] + '\n' + all.slotRows[6] + ' ' + all.slotRows[7] + ' ' + all.slotRows[8]);
    if (all.coins > 0) {
      message.channel.send("You Won " + all.coins + "!\nYour coin multiplicator is " + all.mltipler);
    } else {
      message.channel.send("You Lost " + all.coins + '!');
    }

    return all.coins;
  }

  function wage() {
    var ts = UTIL.getTimestamp();
    var path = '/tmp/' + message.author.id + '.json';
    var readFile;
    var obj;
    if (FS.existsSync(path)) {
      readFile = FS.readFile(path,'utf8', function(err){
        if (err) {
          return console.log(err);
                }
      });
      obj = JSON.parse(readFile);
      if (ts > Number(obj.timestamp) + 54000) {
        UTIL.addCoins(message);
        UTIL.writeObjProperty(message,'timestamp', ts);
      } else {
        console.log(obj.timestamp);
        message.channel.send('Sorry!\nIt looks like you already got your daily reward.\nPlease try again in ' + UTIL.getHours(Number(obj.timestamp) + 54000 - ts));
      }<commit_msg>Revert "fixed wage"<commit_after>/*
  A ping pong bot, whenever you send "ping", it replies "pong".
*/

// Import the discord.js module
const DISCORD = require("discord.js");
const EXECFILE = require("child_process").execFile;
const FS = require('fs');
const SLTS = require('./slots');
const EVENTS = require('./events');
const UTIL = require('./util');
// Create an instance of a Discord CLIENT
const CLIENT = new DISCORD.Client();

// The TOKEN of your bot - https://discordapp.com/developers/applications/me
const TOKEN = '<KEY>';

// The ready event is vital, it means that your bot will only start reacting to information
// from Discord _after_ ready is emitted
CLIENT.on('ready', () => {
  console.log('I am ready!');
});

// Create an event listener for messages
CLIENT.on('message', message => {

  function slots(amount) {
    var path = '/tmp/' + message.author.id + '.json';
    if (FS.existsSync(path) == false) {
      UTIL.addCoins(message);
    }
    var readFile = FS.readFile(path,'utf8', function(err){
      if (err) {
        return console.log(err);
              }
    });
    var obj = JSON.parse(readFile);

    if (SLTS.checkrequirements(obj, amount)) {
      console.log(amount[2]);
      obj.coins = Number(obj.coins) + sendSlotResults(SLTS.slotsLogic(SLTS.genSlotsNumbers(), Number(amount[2]), amount[1].toLowerCase()));
      FS.writeFile(path, JSON.stringify(obj), function(err){
        if (err) {
          return console.log(err);
                }
      });
    } else {
      console.log(obj.coins);
      message.channel.send("You don't have enough coins to play slots");
    }
  }
  // Handles the display of the slots results
  function sendSlotResults(all) {
    message.channel.send('   S   L   O   T   S   ');
    all.slotRows = SLTS.changeNrToEmo(all.slotRows);
    message.channel.send(all.slotRows[0] + ' ' + all.slotRows[1] + ' ' + all.slotRows[2] + '\n' + all.slotRows[3] + ' ' + all.slotRows[4] + ' ' + all.slotRows[5] + '\n' + all.slotRows[6] + ' ' + all.slotRows[7] + ' ' + all.slotRows[8]);
    if (all.coins > 0) {
      message.channel.send("You Won " + all.coins + "!\nYour coin multiplicator is " + all.mltipler);
    } else {
      message.channel.send("You Lost " + all.coins + '!');
    }

    return all.coins;
  }

  function wage() {
    var ts = UTIL.getTimestamp();
    var path = '/tmp/' + message.author.id + '.json';
    var readFile;
    var obj;
    if (FS.existsSync(path)) {
      readFile = FS.readFile(path,'utf8', function(err){
        if (err) {
          return console.log(err);
                }
      });
      obj = JSON.parse(readFile);
      if (ts > Number(obj.timestamp) + 54000) {
        UTIL.addCoins(message);
      } else {
        console.log(obj.timestamp);
        message.channel.send('Sorry!\nIt looks like you already got your daily reward.\nPlease try again in ' + UTIL.getHours(Number(obj.timestamp) + 54000 - ts));
      }
{'fraction_non_alphanumeric': 0.16162988115449914, 'fraction_numerical': 0.008488964346349746, 'mean_word_length': 2.7426937738246506, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '302491', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1916, 'n_words': 460}