From a7318d8afb67780f8617cee45f137145007ddcb9 Mon Sep 17 00:00:00 2001 From: Chiang Fong Lee Date: Thu, 2 Jun 2016 18:12:20 +0800 Subject: [PATCH 1/3] Disable historian script --- scripts/historian.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/historian.coffee b/scripts/historian.coffee index b548d20..8a475ad 100644 --- a/scripts/historian.coffee +++ b/scripts/historian.coffee @@ -8,8 +8,8 @@ URL = process.env.HUBOT_HISTORIAN_URL || "http://192.168.100.242:56400" module.exports = (robot) -> - robot.hear /.*/i, (msg) -> - log = "#{new Date()} | #{msg.message.room} | #{msg.message.user.name} | #{msg.message}" - robot.http(URL) - .header('Content-Type', 'application/text') - .post(log) + # robot.hear /.*/i, (msg) -> + # log = "#{new Date()} | #{msg.message.room} | #{msg.message.user.name} | #{msg.message}" + # robot.http(URL) + # .header('Content-Type', 'application/text') + # .post(log) From 89218911b6ffb15fce0d41a3c37fe84619c40e73 Mon Sep 17 00:00:00 2001 From: Chiang Fong Lee Date: Thu, 2 Jun 2016 18:15:33 +0800 Subject: [PATCH 2/3] Resolve deprecated hubot-scripts - Use the hubot-xkcd npm package instead, added via `npm install --save` and external-scripts.json - Import all other referenced scripts by hand - See: https://github.com/github/hubot-scripts/issues/1113 --- external-scripts.json | 4 +-- hubot-scripts.json | 10 +----- package.json | 3 +- scripts/demolition-man.coffee | 51 ++++++++++++++++++++++++++++ scripts/gorbypuff.coffee | 62 +++++++++++++++++++++++++++++++++++ scripts/grumpycat.coffee | 54 ++++++++++++++++++++++++++++++ scripts/ruby.coffee | 33 +++++++++++++++++++ scripts/ruby_rules.coffee | 22 +++++++++++++ scripts/rubygems.coffee | 26 +++++++++++++++ 9 files changed, 253 insertions(+), 12 deletions(-) create mode 100644 scripts/demolition-man.coffee create mode 100644 scripts/gorbypuff.coffee create mode 100644 scripts/grumpycat.coffee create mode 100644 scripts/ruby.coffee create mode 100644 scripts/ruby_rules.coffee create mode 100644 scripts/rubygems.coffee diff --git a/external-scripts.json b/external-scripts.json index 10cf233..f5895dd 100644 --- a/external-scripts.json +++ b/external-scripts.json @@ -8,6 +8,6 @@ "hubot-redis-brain", "hubot-rules", "hubot-shipit", - "hubot-spot", - "hubot-standup-alarm" + "hubot-standup-alarm", + "hubot-xkcd" ] diff --git a/hubot-scripts.json b/hubot-scripts.json index f95585f..fe51488 100644 --- a/hubot-scripts.json +++ b/hubot-scripts.json @@ -1,9 +1 @@ -[ - "ruby.coffee", - "rubygems.coffee", - "ruby_rules.coffee", - "grumpycat.coffee", - "gorbypuff.coffee", - "demolition-man.coffee", - "xkcd.coffee" -] +[] diff --git a/package.json b/package.json index a162748..bf1a9a6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "hubot-shipit": "^0.2.0", "hubot-slack": "^3.0.0", "hubot-spot": "^1.0", - "hubot-standup-alarm": "0.0.7" + "hubot-standup-alarm": "0.0.7", + "hubot-xkcd": "0.0.3" }, "engines": { "node": "0.10.x" diff --git a/scripts/demolition-man.coffee b/scripts/demolition-man.coffee new file mode 100644 index 0000000..e9c900d --- /dev/null +++ b/scripts/demolition-man.coffee @@ -0,0 +1,51 @@ +# Description: +# Watch your language! +# +# Dependencies: +# None +# +# Configuration: +# None +# +# Commands: +# +# Author: +# whitman, jan0sch + +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('(?:^|\\s)(' + words.join('|') + ')(?:\\s|\\.|\\?|!|$)', 'i'); + + robot.hear regex, (msg) -> + msg.send 'You have been fined one credit for a violation of the verbal morality statute.' \ No newline at end of file diff --git a/scripts/gorbypuff.coffee b/scripts/gorbypuff.coffee new file mode 100644 index 0000000..1108af8 --- /dev/null +++ b/scripts/gorbypuff.coffee @@ -0,0 +1,62 @@ +# Description: +# Gorbypuff Thunderstone +# +# Dependencies: +# None +# +# Configuration: +# None +# +# Commands: +# gorby - Display a picture of everyone's favorite flat-faced cat +# +# Author: +# bradly + +gorbies = [ + "http://24.media.tumblr.com/ded6b610059bac9203432ae1999fb439/tumblr_mix1ntHwN21rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/4eaabf5111c8444e68208adaa22c1c3a/tumblr_mewmgwxzZA1rt6kj7o1_1280.jpg", + "http://24.media.tumblr.com/tumblr_me3ubx13ck1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_md5v15WAWI1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_mcbxaz9w7T1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_mbqotcRr4j1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_m99wdgHcNN1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_m94zjtC4sy1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_m8cju4aFeS1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m7a3unqPjr1rt6kj7o1_1280.jpg", + "http://25.media.tumblr.com/tumblr_m6lev83Gak1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m6leq7NrsY1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m5vy9hfcTs1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m5g0bmkl601rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m5g0ab3EiH1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m51suk3wfS1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m50tx5IWhJ1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m4q48mVFXj1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m4hxmurzlL1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m4hxioPUln1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m4gqg94kSA1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m4c9ncT0LM1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m44m5g6m001rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m3v8keZVhR1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m3k8rvS6Uq1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m3k88eKJQf1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m3elppeyqa1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m3ekqyJ1iy1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m35xkkGbKO1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m305ndXRNH1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m2v55jdLgV1rt6kj7o1_500.png", + "http://25.media.tumblr.com/tumblr_m2ro01h07O1rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m2olbl9Uw61rt6kj7o1_1280.png", + "http://25.media.tumblr.com/tumblr_m2n4grjjN51rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m2j8mhAuMm1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m2i8utX5Qv1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m2i85ws1561rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m288synRIj1rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m21kfe7zir1rt6kj7o1_400.png", + "http://25.media.tumblr.com/tumblr_m21hprOGO71rt6kj7o1_1280.png", + "http://24.media.tumblr.com/tumblr_m21gc84uY21rt6kj7o1_1280.png" +] + +module.exports = (robot) -> + robot.hear /gorby|puff|thunderhorse/i, (msg) -> + msg.send msg.random gorbies diff --git a/scripts/grumpycat.coffee b/scripts/grumpycat.coffee new file mode 100644 index 0000000..1bc534b --- /dev/null +++ b/scripts/grumpycat.coffee @@ -0,0 +1,54 @@ +# Description: +# Load a random Grumpy Cat from an array of images. +# Based on pugme. +# +# Dependencies: +# None +# +# Configuration: +# None +# +# Commands: +# hubot grumpycat me - Receive a Grumpy Cat +# hubot grumpycat bomb N - get N Grumpy Cats +# +# Author: +# trey + +cats = [ + "http://mlkshk.com/r/M6EO.gif", # rabbit in a hat + "http://mlkshk.com/r/M17S.gif", # dress + "http://mlkshk.com/r/M15O.gif", # le mis + "http://mlkshk.com/r/M01A.gif", # cartoons + "http://mlkshk.com/r/LZ7U.gif", # fuck this + "http://mlkshk.com/r/LXP2.gif", # grumpy tardar sauce + "http://mlkshk.com/r/LWNG.gif", # grandma got run over + "http://mlkshk.com/r/LVVR.gif", # double deal with it + "http://mlkshk.com/r/LV0S.gif", # mural + "http://mlkshk.com/r/LUYE.gif", # stahp + "http://mlkshk.com/r/LUO2.gif", # good + "http://mlkshk.com/r/LS6R.gif", # shut the fuck up + "http://mlkshk.com/r/LSWD.gif", # Tardar Bonepart + "http://mlkshk.com/r/LPCN.gif", # drawing + "http://mlkshk.com/r/LLVD.gif", # terrible time of the year + "http://mlkshk.com/r/LKTG.gif", # Citizen Kane + "http://mlkshk.com/r/LEF8.gif", # emotions + "http://mlkshk.com/r/LEFR.gif", # skate deck + "http://mlkshk.com/r/L337.gif", # look askance + "http://mlkshk.com/r/KV8K.gif", # sitting + "http://mlkshk.com/r/KU1S.gif", # 3 grump moon + "http://mlkshk.com/r/KRBA.gif", # rabbit painting + "http://mlkshk.com/r/KL19.gif" # lying on the ground +] + +module.exports = (robot) -> + robot.respond /grumpycat me/i, (msg) -> + msg.send cats[Math.floor(Math.random()*cats.length)] + + robot.respond /grumpycat bomb( (\d+))?/i, (msg) -> + count = msg.match[2] || 5 + for i in [1..count] by 1 + msg.send cats[Math.floor(Math.random()*cats.length)] + + robot.respond /how many grumpycats are there/i, (msg) -> + msg.send "There are #{cats.length} grumpycats." \ No newline at end of file diff --git a/scripts/ruby.coffee b/scripts/ruby.coffee new file mode 100644 index 0000000..235bc74 --- /dev/null +++ b/scripts/ruby.coffee @@ -0,0 +1,33 @@ +# Description: +# Evaluate one line of Ruby script +# +# Dependencies: +# None +# +# Configuration: +# None +# +# Commands: +# hubot ruby|rb