|
| 1 | +# Description: |
| 2 | +# Example scripts for you to examine and try out. |
| 3 | +# |
| 4 | +# Notes: |
| 5 | +# They are commented out by default, because most of them are pretty silly and |
| 6 | +# wouldn't be useful and amusing enough for day to day huboting. |
| 7 | +# Uncomment the ones you want to try and experiment with. |
| 8 | +# |
| 9 | +# These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md |
| 10 | + |
| 11 | +module.exports = (robot) -> |
| 12 | + |
| 13 | + # robot.hear /badger/i, (res) -> |
| 14 | + # res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS" |
| 15 | + # |
| 16 | + # robot.respond /open the (.*) doors/i, (res) -> |
| 17 | + # doorType = res.match[1] |
| 18 | + # if doorType is "pod bay" |
| 19 | + # res.reply "I'm afraid I can't let you do that." |
| 20 | + # else |
| 21 | + # res.reply "Opening #{doorType} doors" |
| 22 | + # |
| 23 | + # robot.hear /I like pie/i, (res) -> |
| 24 | + # res.emote "makes a freshly baked pie" |
| 25 | + # |
| 26 | + # lulz = ['lol', 'rofl', 'lmao'] |
| 27 | + # |
| 28 | + # robot.respond /lulz/i, (res) -> |
| 29 | + # res.send res.random lulz |
| 30 | + # |
| 31 | + # robot.topic (res) -> |
| 32 | + # res.send "#{res.message.text}? That's a Paddlin'" |
| 33 | + # |
| 34 | + # |
| 35 | + # enterReplies = ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you'] |
| 36 | + # leaveReplies = ['Are you still there?', 'Target lost', 'Searching'] |
| 37 | + # |
| 38 | + # robot.enter (res) -> |
| 39 | + # res.send res.random enterReplies |
| 40 | + # robot.leave (res) -> |
| 41 | + # res.send res.random leaveReplies |
| 42 | + # |
| 43 | + # answer = process.env.HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING |
| 44 | + # |
| 45 | + # robot.respond /what is the answer to the ultimate question of life/, (res) -> |
| 46 | + # unless answer? |
| 47 | + # res.send "Missing HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING in environment: please set and try again" |
| 48 | + # return |
| 49 | + # res.send "#{answer}, but what is the question?" |
| 50 | + # |
| 51 | + # robot.respond /you are a little slow/, (res) -> |
| 52 | + # setTimeout () -> |
| 53 | + # res.send "Who you calling 'slow'?" |
| 54 | + # , 60 * 1000 |
| 55 | + # |
| 56 | + # annoyIntervalId = null |
| 57 | + # |
| 58 | + # robot.respond /annoy me/, (res) -> |
| 59 | + # if annoyIntervalId |
| 60 | + # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" |
| 61 | + # return |
| 62 | + # |
| 63 | + # res.send "Hey, want to hear the most annoying sound in the world?" |
| 64 | + # annoyIntervalId = setInterval () -> |
| 65 | + # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" |
| 66 | + # , 1000 |
| 67 | + # |
| 68 | + # robot.respond /unannoy me/, (res) -> |
| 69 | + # if annoyIntervalId |
| 70 | + # res.send "GUYS, GUYS, GUYS!" |
| 71 | + # clearInterval(annoyIntervalId) |
| 72 | + # annoyIntervalId = null |
| 73 | + # else |
| 74 | + # res.send "Not annoying you right now, am I?" |
| 75 | + # |
| 76 | + # |
| 77 | + # robot.router.post '/hubot/chatsecrets/:room', (req, res) -> |
| 78 | + # room = req.params.room |
| 79 | + # data = JSON.parse req.body.payload |
| 80 | + # secret = data.secret |
| 81 | + # |
| 82 | + # robot.messageRoom room, "I have a secret: #{secret}" |
| 83 | + # |
| 84 | + # res.send 'OK' |
| 85 | + # |
| 86 | + # robot.error (err, res) -> |
| 87 | + # robot.logger.error "DOES NOT COMPUTE" |
| 88 | + # |
| 89 | + # if res? |
| 90 | + # res.reply "DOES NOT COMPUTE" |
| 91 | + # |
| 92 | + # robot.respond /have a soda/i, (res) -> |
| 93 | + # # Get number of sodas had (coerced to a number). |
| 94 | + # sodasHad = robot.brain.get('totalSodas') * 1 or 0 |
| 95 | + # |
| 96 | + # if sodasHad > 4 |
| 97 | + # res.reply "I'm too fizzy.." |
| 98 | + # |
| 99 | + # else |
| 100 | + # res.reply 'Sure!' |
| 101 | + # |
| 102 | + # robot.brain.set 'totalSodas', sodasHad+1 |
| 103 | + # |
| 104 | + # robot.respond /sleep it off/i, (res) -> |
| 105 | + # robot.brain.set 'totalSodas', 0 |
| 106 | + # res.reply 'zzzzz' |
0 commit comments