<commit_before>'use strict'

function run (db, msg) {
  var color = getRandomColor()

  var color_image_url = 'https://dummyimage.com/100x100/' + color + '/' + color + '.jpg'
  msg.say('Give this color a unique name?')
    .say({
      text: '',
      "attachments": [
        {
          "fallback": color,
          "color": color,
          "pretext": '',
          "title": '',
          "title_link": '',
          "text": '',
          "image_url": color_image_url,
          "thumb_url": color_image_url,
        }
      ]
    })
    .route('color_response', { 'color' : color })
}

function response (db, msg, state) {
  var color = state.color
  db.saveUserColor(msg.body.event.user, {  color : msg.body.event.text }, (err, convo) => {
    if (err)
    {
      console.log(err)
    }
  })
  msg.say(['Thanks, I have taken note.', 'Sounds good, I am keeping track of these.', 'Thanks, keep up the good work.'])
}

// Retrieve a random color
function getRandomColor () {
    var letters = '0123456789ABCDEF'
    var color = ''
    for (var i = 0; i < 6; i++) {
        color += letters[Math.floor(Math.random() * 16)]
    }
    return color
}

module.exports = {
	run: run,
  response: response
}<commit_msg>Save color.<commit_after>'use strict'

function run (db, msg) {
  var color = getRandomColor()

  var color_image_url = 'https://dummyimage.com/100x100/' + color + '/' + color + '.jpg'
  msg.say('Give this color a unique name?')
    .say({
      text: '',
      "attachments": [
        {
          "fallback": color,
          "color": color,
          "pretext": '',
          "title": '',
          "title_link": '',
          "text": '',
          "image_url": color_image_url,
          "thumb_url": color_image_url,
        }
      ]
    })
    .route('color_response', { 'color' : color })
}

function response (db, msg, state) {
  var color = state.color
  db.saveUserColor(msg.body.event.user, {  'color' : msg.body.event.text }, (err, convo) => {
    if (err)
    {
      console.log(err)
    }
  })
  msg.say(['Thanks, I have taken note.', 'Sounds good, I am keeping track of these.', 'Thanks, keep up the good work.'])
}

// Retrieve a random color
function getRandomColor () {
    var letters = '0123456789ABCDEF'
    var color = ''
    for (var i = 0; i < 6; i++) {
        color += letters[Math.floor(Math.random() * 16)]
    }
    return color
}

module.exports = {
	run: run,
  response: response
}
{'fraction_non_alphanumeric': 0.16584362139917697, 'fraction_numerical': 0.01646090534979424, 'mean_word_length': 2.2456608811748997, 'pattern_counts': {'":': 18, '<': 5, '<?xml version=': 0, '>': 5, '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': '314934', 'n_tokens_mistral': 844, 'n_tokens_neox': 804, 'n_words': 205}