<commit_before># Description:
#   Your dog friend guards access to your most prized commands
#
# Commands:
#
# Author:
#   bcoia

{ REGEX, STRINGS } = require '../helpers/constants'
strings = STRINGS.access

Organization = require('../models/organization').get()

module.exports = (robot) ->
  Logger = require('../helpers/logger')(robot)

  isAdminUser = (user) ->
    return user? and user in process.env.ADMINS.split(" ")

  robot.listenerMiddleware (context, next, done) ->
    command = context.listener.options.id
    message = context.response.message
    username = context.response.message.user.name
    if command is null
      # Ignore unknown commands or catch-alls
      next()
    else if username is 'hubot' or username is 'ibizan'
      # Ignore myself and messages overheard
      done()
    else
      if not Organization.ready()
        # Organization is not ready, ignore command
        context.response.send strings.orgnotready
        Logger.addReaction 'x', message
        done()
      else<commit_msg>Fixed catchAll responding to itself and errors<commit_after># Description:
#   Your dog friend guards access to your most prized commands
#
# Commands:
#
# Author:
#   bcoia

{ REGEX, STRINGS } = require '../helpers/constants'
strings = STRINGS.access

Organization = require('../models/organization').get()

module.exports = (robot) ->
  Logger = require('../helpers/logger')(robot)

  isAdminUser = (user) ->
    return user? and user in process.env.ADMINS.split(" ")

  robot.listenerMiddleware (context, next, done) ->
    command = context.listener.options.id
    message = context.response.message
    username = context.response.message.user.name
    if username is 'hubot' or username is 'ibizan'
      # Ignore myself and messages overheard
      done()
    else if command is null
      # Ignore unknown commands or catch-alls
      next()
    else
      if not Organization.ready()
        # Organization is not ready, ignore command
        context.response.send strings.orgnotready
        Logger.addReaction 'x', message
        done()
      else
{'fraction_non_alphanumeric': 0.10637278390033542, 'fraction_numerical': 0.0, 'mean_word_length': 2.9923518164435947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2980144', 'n_tokens_mistral': 590, 'n_tokens_neox': 591, 'n_words': 179}