Created
December 6, 2013 14:46
-
-
Save tijn/7825902 to your computer and use it in GitHub Desktop.
A script to make a hubot respond to foul language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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