Last Updated: July 16, 2021
·
1.091K
· 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()

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside