Last Updated: July 16, 2021
·
873
· camachgk

Calm Down, Hubot

A simple script to help calm things down with Hubot

# Description:
#   Calm down
#
# Commands:
#   hubot calm me | manatee me - Reply with Manatee
#   calm down | simmer down | that escalated quickly - Reply with Manatee
#   ALL CAPS | LONGCAPS - Reply with Manatee

module.exports = (robot) ->
  manatee = -> 
    num = Math.floor(Math.random() * 30) + 1
    "http://calmingmanatee.com/img/manatee#{ num }.jpg"

  robot.respond /manatee|calm( me)?/i, (msg) -> msg.send manatee()

  robot.hear ///
    (calm down)|
    (simmer down)|
    (that escalated quickly)
  ///i, (msg) -> msg.send manatee()

  robot.hear ///
    (([A-Z]{2,}\s+)([A-Z]{2,})\s?)|
    ([A-Z]{5,})
  ///, (msg) -> msg.send manatee()