<commit_before># Description:
#   Watch your language!
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#
# Author:
#   whitman, jan0sch
moment = require 'moment'

module.exports = (robot) ->

  words = [
    'arsch',
    'arschloch',
    'arse',
    'ass',
    'bastard',
    'bitch',
    'bugger',
    'bollocks',
    'bullshit',
    'cock',
    'cunt',
    'damn',
    'damnit',
    'depp',
    'dick',
    'douche',
    'fag',
    'fotze',
    'fuck',
    'fucked',
    'fucking',
    'kacke',
    'piss',
    'pisse',
    'scheisse',
    'schlampe',
    'shit',
    'wank',
    'wichser'
  ]
  regex = new RegExp("\\b(#{words.join('|')})\\b", 'ig')

  robot.hear regex, (msg) ->
    credit = msg.message.text.match(regex).length

    key = moment().format('YYYYMMDD')
    user = msg.message.user.name

    logMe = new Logger robot
    logMe.add user, credit

    if robot.brain.violation[user][key]
      warn = user + ", you have been fined " + robot.brain.violation[user][key] + " credits today"
      msg.send 'You have been fined ' + credit + ' credit(s) for a violation of the verbal morality statute. ('+warn+')'

class Logger

  constructor: (robot) ->
    robot.brain.violation ?= {}
    @theBrain = robot.brain

    add: (user, credits, dateKey) ->
      dateKey ?= moment().format('YYYYMMDD')

      try
        if not @theBrain.violation[user]
          @theBrain.violation[user] = {}
          @theBrain.violation[user][dateKey] = credits
        else
          if not @theBrain.violation[user][dateKey]
            @theBrain.violation[user][dateKey] = credits
          else
            @theBrain.violation[user][dateKey] += credits
      catch error
        console.log error
<commit_msg>fixed mental variable names<commit_after># Description:
#   Watch your language!
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#
# Author:
#   whitman, jan0sch
moment = require 'moment'

module.exports = (robot) ->

  words = [
    'arsch',
    'arschloch',
    'arse',
    'ass',
    'bastard',
    'bitch',
    'bugger',
    'bollocks',
    'bullshit',
    'cock',
    'cunt',
    'damn',
    'damnit',
    'depp',
    'dick',
    'douche',
    'fag',
    'fotze',
    'fuck',
    'fucked',
    'fucking',
    'kacke',
    'piss',
    'pisse',
    'scheisse',
    'schlampe',
    'shit',
    'wank',
    'wichser'
  ]
  regex = new RegExp("\\b(#{words.join('|')})\\b", 'ig')

  robot.hear regex, (msg) ->
    credit = msg.message.text.match(regex).length

    key = moment().format('YYYYMMDD')
    user = msg.message.user.name

    log = new Logger robot
    log.add user, credit

    if robot.brain.violation[user][key]
      warn = user + ", you have been fined " + robot.brain.violation[user][key] + " credits today"
      msg.send 'You have been fined ' + credit + ' credit(s) for a violation of the verbal morality statute. ('+warn+')'

class Logger

  constructor: (robot) ->
    robot.brain.violation ?= {}
    @brain = robot.brain

    add: (user, credits, dateKey) ->
      dateKey ?= moment().format('YYYYMMDD')

      try
        if not @brain.violation[user]
          @brain.violation[user] = {}
          @brain.violation[user][dateKey] = credits
        else
          if not @brain.violation[user][dateKey]
            @brain.violation[user][dateKey] = credits
          else
            @brain.violation[user][dateKey] += credits
      catch error
        console.log error

{'fraction_non_alphanumeric': 0.1620679639848969, 'fraction_numerical': 0.0005808887598024978, 'mean_word_length': 2.3698630136986303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1200207', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1217, 'n_words': 259}