<commit_before># Description:
#   Move an deceased greyhound to the Rainbow Bridge page
#
# Commands:
#   hubot goodbye <greyhound> [yyyy-mm-dd] - Moves a deceased greyhound to the Rainbow Bridge page
#
# Author:
#   <NAME> (zachwhaley) <<EMAIL>>

git = require '../lib/git'
site = require '../lib/site'
util = require '../lib/util'

goodbye = (greyhound, name, dod, callback) ->
  site.loadGreyhound greyhound, (info, bio) ->
    if not info?
      return callback "Sorry, couldn't find #{greyhound} 😕"

    if info.category is 'deceased'
      return callback "#{name} has already crossed the Rainbow Bridge 😢"

    info.category = 'deceased'
    info.dod = new Date(dod) if dod?
    site.dumpGreyhound greyhound, info, bio, callback

module.exports = (robot) ->
  robot.respond /goodbye (.+?)\s*(\d{4}-\d{1,2}-\d{1,2})?$/i, (res) ->
    greyhound = util.slugify res.match[1]
    name = util.capitalize res.match[1]
    dod = res.match[2]
    console.log "user: #{res.message.user}"
    gitOpts =
      message: "#{name} crossed the Rainbow Bridge 😢"
      branch: "goodbye-#{greyhound}"
      user:
        name: res.message.user?.real_name
        email: res.message.user?.profile?.email

    res.reply "Moving #{name} to the Rainbow Bridge 😢\n" +
              "Hang on a sec..."

    git.update goodbye, greyhound, name, dod, gitOpts, (err) ->
      unless err?
        res.reply "#{name} moved to the Rainbow Bridge 😢"
      else
        res.reply err<commit_msg>Print JSON object<commit_after># Description:
#   Move an deceased greyhound to the Rainbow Bridge page
#
# Commands:
#   hubot goodbye <greyhound> [yyyy-mm-dd] - Moves a deceased greyhound to the Rainbow Bridge page
#
# Author:
#   <NAME> (zachwhaley) <<EMAIL>>

git = require '../lib/git'
site = require '../lib/site'
util = require '../lib/util'

goodbye = (greyhound, name, dod, callback) ->
  site.loadGreyhound greyhound, (info, bio) ->
    if not info?
      return callback "Sorry, couldn't find #{greyhound} 😕"

    if info.category is 'deceased'
      return callback "#{name} has already crossed the Rainbow Bridge 😢"

    info.category = 'deceased'
    info.dod = new Date(dod) if dod?
    site.dumpGreyhound greyhound, info, bio, callback

module.exports = (robot) ->
  robot.respond /goodbye (.+?)\s*(\d{4}-\d{1,2}-\d{1,2})?$/i, (res) ->
    greyhound = util.slugify res.match[1]
    name = util.capitalize res.match[1]
    dod = res.match[2]
    console.log "user: %j", res.message.user}
    gitOpts =
      message: "#{name} crossed the Rainbow Bridge 😢"
      branch: "goodbye-#{greyhound}"
      user:
        name: res.message.user?.real_name
        email: res.message.user?.profile?.email

    res.reply "Moving #{name} to the Rainbow Bridge 😢\n" +
              "Hang on a sec..."

    git.update goodbye, greyhound, name, dod, gitOpts, (err) ->
      unless err?
        res.reply "#{name} moved to the Rainbow Bridge 😢"
      else
        res.reply err
{'fraction_non_alphanumeric': 0.14799728445349628, 'fraction_numerical': 0.005431093007467753, 'mean_word_length': 2.8173575129533677, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '7021306', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1008, 'n_words': 296}