Skip to content

Instantly share code, notes, and snippets.

@tijn
Created December 6, 2013 14:46
Show Gist options
  • Save tijn/7825902 to your computer and use it in GitHub Desktop.
Save tijn/7825902 to your computer and use it in GitHub Desktop.
A script to make a hubot respond to foul language.
module.exports = (robot) ->
robot.hear /\bfucking\s+?(\w+)/i, (msg) ->
msg.send "fucking #{msg.match[1]} indeed".toUpperCase()
robot.hear /\bfuck(\s+?(?:my|your|this|those|these|our))?\s+?(\w+)/i, (msg) ->
pronoun = msg.match[1]
subject = msg.match[2]
pronoun = pronoun.trim().toLowerCase() if pronoun
pronoun = 'your' if pronoun == 'my' || pronoun == 'our'
subject = 'you' if subject.toLowerCase() == 'i'
msg.send "fuck#{if pronoun then " #{pronoun}" else ''} #{subject}".toUpperCase()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment