<commit_before>#
# 主に発表者をランダムで指定する
#

happyo = []

{TextListener} = require 'hubot/src/listener'


module.exports = (robot) ->
  removeListener = (listener) ->
    index = robot.listeners.indexOf listener
    robot.listeners.splice index, 1 if index != 1

  waitForResponse = (waitMsg, callback) ->
    userId = waitMsg.envelope.user.id
    room = waitMsg.envelope.room
    listener = new TextListener robot, /.*/, (msg) ->
      {envelope} = msg
      if envelope.room is room and envelope.user.id is userId
        removeListener listener
        if msg.envelope.message.text.toLowerCase() is '<end>'
          waitMsg.reply '追加しました'
        else
          callback.apply null, arguments
    robot.listeners.push listener

  robot.respond /発表者\s+一覧/i, (msg) ->
    msg.send "発表者一覧"
    for name, idx in happyo
      msg.send "  (#{idx})#{name}"

  robot.respond /発表者\s+追加/i, (msg) ->
    msg.reply "発表者を追加します。終了する場合は <end> と入力してください。"
    waitForResponse msg, (msg) ->
      # ここら辺に追加用のコードを書く予定

    
<commit_msg>mod 2015.02.11<commit_after>#
# 主に発表者をランダムで指定する
#

happyo = []

{TextListener} = require 'hubot/src/listener'

module.exports = (robot) ->
  removeListener = (listener) ->
    index = robot.listeners.indexOf listener
    robot.listeners.splice index, 1 if index != 1

  waitForResponse = (waitMsg, callback) ->
    userId = waitMsg.envelope.user.id
    room = waitMsg.envelope.room
    listener = new TextListener robot, /.*/, (msg) ->
      {envelope} = msg
      if envelope.room is room and envelope.user.id is userId
        removeListener listener
        if msg.envelope.message.text.toLowerCase() is '<end>'
          waitMsg.reply '追加しました'
        else
          callback.apply null, arguments
    robot.listeners.push listener

  robot.respond /発表者\s+一覧/i, (msg) ->
    msg.send '発表者一覧'
    for name, idx in happyo
      msg.send '  (#{idx})#{name}'

  robot.respond /発表者\s+追加/i, (msg) ->
    msg.reply '発表者を追加します。終了する場合は <end> と入力してください。'
    waitForResponse msg, (msg) ->
      msg.reply '? '

{'fraction_non_alphanumeric': 0.13125309559187717, 'fraction_numerical': 0.005943536404160475, 'mean_word_length': 2.6660617059891107, 'pattern_counts': {'":': 0, '<': 7, '<?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': '628961', 'n_tokens_mistral': 779, 'n_tokens_neox': 772, 'n_words': 157}