diff --git a/external-scripts.json b/external-scripts.json index ecf3ee0..a077202 100644 --- a/external-scripts.json +++ b/external-scripts.json @@ -1,7 +1,6 @@ [ "hubot-diagnostics", "hubot-help", - "hubot-heroku-keepalive", "hubot-google-images", "hubot-google-translate", "hubot-pugme", diff --git a/hubot-scripts.json b/hubot-scripts.json index 0637a08..4db2008 100644 --- a/hubot-scripts.json +++ b/hubot-scripts.json @@ -1 +1 @@ -[] \ No newline at end of file +["9gag.coffee","aww.coffee","base64.coffee","chuck-norris.coffee","google.coffee","lyrics.coffee","stallman.coffee","hackernews.coffee"] diff --git a/package.json b/package.json index c497dc5..a32d256 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "description": "Il miglior amico della 5IA", "dependencies": { "cheerio": "^0.19.0", + "htmlparser": "^1.7.7", "hubot": "^2.12.0", "hubot-bitcoin": "^1.0.3", "hubot-diagnostics": "0.0.1", @@ -23,6 +24,8 @@ "hubot-youtube": "^0.1.2", "moment": "^2.10.2", "nightmare": "^1.8.0", + "nodepie": "^0.6.7", + "soupselect": "^0.2.0", "weak": "^0.4.0" }, "engines": { diff --git a/scripts/agenda.coffee b/scripts/agenda.coffee index 18c4e10..e1f5c9d 100644 --- a/scripts/agenda.coffee +++ b/scripts/agenda.coffee @@ -1,3 +1,22 @@ +# Description: +# si collega al registro elettronico e controlla l'agenda +# +# Dependencies: +# "cheerio": "0.19.0" +# "nightmare": "1.8.0" +# "moment": "2.10.2" +# +# Configuration: +# REGISTRO_USERNAME - username per login al registro +# REGISTRO_PASSWORD - password per login al registro +# +# Commands: +# hubot cosa c'è per (domani|il (data))? - controlla agenda per la data richiesta +# +# Author: +# Enrico Fasoli (fazo96) +# + Nightmare = require 'nightmare' cheerio = require 'cheerio' moment = require 'moment' @@ -33,6 +52,8 @@ downloadAgenda = (day, cb) -> cb tab cosaCePerIl = (day,res) -> + unless process.env.REGISTRO_USERNAME and process.env.REGISTRO_PASSWORD + return res.send 'non dispongo delle credenziali per il registro :(' res.send 'aspetta che guardo l\'agenda per il '+day+' (potrei metterci fino a 3 minuti)' downloadAgenda day, (data) -> if data.length is 0 diff --git a/scripts/circolari.coffee b/scripts/circolari.coffee index cef67ef..481553d 100644 --- a/scripts/circolari.coffee +++ b/scripts/circolari.coffee @@ -1,3 +1,19 @@ +# Description: +# si collega al sito della scuola e legge le circolari +# +# Dependencies: +# "cheerio": "0.19.0" +# +# Configuration: +# None +# +# Commands: +# hubot circolari - stampa la lista delle ultime circolari +# +# Author: +# Enrico Fasoli (fazo96) +# + cheerio = require('cheerio') fs = require('fs') diff --git a/scripts/example.coffee b/scripts/example.coffee deleted file mode 100644 index 7c9839c..0000000 --- a/scripts/example.coffee +++ /dev/null @@ -1,106 +0,0 @@ -# Description: -# Example scripts for you to examine and try out. -# -# Notes: -# They are commented out by default, because most of them are pretty silly and -# wouldn't be useful and amusing enough for day to day huboting. -# Uncomment the ones you want to try and experiment with. -# -# These are from the scripting documentation: https://github.com/github/hubot/blob/master/docs/scripting.md - -module.exports = (robot) -> - - # robot.hear /badger/i, (res) -> - # res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS" - # - # robot.respond /open the (.*) doors/i, (res) -> - # doorType = res.match[1] - # if doorType is "pod bay" - # res.reply "I'm afraid I can't let you do that." - # else - # res.reply "Opening #{doorType} doors" - # - # robot.hear /I like pie/i, (res) -> - # res.emote "makes a freshly baked pie" - # - # lulz = ['lol', 'rofl', 'lmao'] - # - # robot.respond /lulz/i, (res) -> - # res.send res.random lulz - # - # robot.topic (res) -> - # res.send "#{res.message.text}? That's a Paddlin'" - # - # - # enterReplies = ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you'] - # leaveReplies = ['Are you still there?', 'Target lost', 'Searching'] - # - # robot.enter (res) -> - # res.send res.random enterReplies - # robot.leave (res) -> - # res.send res.random leaveReplies - # - # answer = process.env.HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING - # - # robot.respond /what is the answer to the ultimate question of life/, (res) -> - # unless answer? - # res.send "Missing HUBOT_ANSWER_TO_THE_ULTIMATE_QUESTION_OF_LIFE_THE_UNIVERSE_AND_EVERYTHING in environment: please set and try again" - # return - # res.send "#{answer}, but what is the question?" - # - # robot.respond /you are a little slow/, (res) -> - # setTimeout () -> - # res.send "Who you calling 'slow'?" - # , 60 * 1000 - # - # annoyIntervalId = null - # - # robot.respond /annoy me/, (res) -> - # if annoyIntervalId - # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" - # return - # - # res.send "Hey, want to hear the most annoying sound in the world?" - # annoyIntervalId = setInterval () -> - # res.send "AAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIHHHHHHHHHH" - # , 1000 - # - # robot.respond /unannoy me/, (res) -> - # if annoyIntervalId - # res.send "GUYS, GUYS, GUYS!" - # clearInterval(annoyIntervalId) - # annoyIntervalId = null - # else - # res.send "Not annoying you right now, am I?" - # - # - # robot.router.post '/hubot/chatsecrets/:room', (req, res) -> - # room = req.params.room - # data = JSON.parse req.body.payload - # secret = data.secret - # - # robot.messageRoom room, "I have a secret: #{secret}" - # - # res.send 'OK' - # - # robot.error (err, res) -> - # robot.logger.error "DOES NOT COMPUTE" - # - # if res? - # res.reply "DOES NOT COMPUTE" - # - # robot.respond /have a soda/i, (res) -> - # # Get number of sodas had (coerced to a number). - # sodasHad = robot.brain.get('totalSodas') * 1 or 0 - # - # if sodasHad > 4 - # res.reply "I'm too fizzy.." - # - # else - # res.reply 'Sure!' - # - # robot.brain.set 'totalSodas', sodasHad+1 - # - # robot.respond /sleep it off/i, (res) -> - # robot.brain.set 'totalSodas', 0 - # res.reply 'zzzzz' diff --git a/scripts/memoria.coffee b/scripts/memoria.coffee index ffe4ce7..8988a21 100644 --- a/scripts/memoria.coffee +++ b/scripts/memoria.coffee @@ -1,3 +1,21 @@ +# Description: +# permette di salvare e recuperare nozioni +# +# Dependencies: +# "moment": "2.10.2" +# +# Configuration: +# None +# +# Commands: +# hubot ricordati che ... è/sono ... - salva un ricordo +# hubot memoria/a cosa stai pensando? - stampa la lista delle nozioni +# hubot che cos'è/quand'è/quali sono/... ... - richiama un ricordo +# +# Author: +# Enrico Fasoli (fazo96) +# + moment = require 'moment' moment.locale 'it' diff --git a/scripts/misc.coffee b/scripts/misc.coffee index bef4709..540b7be 100644 --- a/scripts/misc.coffee +++ b/scripts/misc.coffee @@ -1,3 +1,26 @@ +# Description: +# piccole cose e easter egg di Asjon +# +# Dependencies: +# None +# +# Configuration: +# None +# +# Commands: +# grazie/bravo asjon - ringrazia asjon +# hubot ringraziamenti - chiedi ad asjon quante volte è stato ringraziato +# hubot sei ... - giudica asjon +# hubot come ti hanno chiamato? - chiedi ad asjon come è stato giudicato +# hubot saluta - saluta l'utente +# ciao asjon - saluta asjon +# +# Author: +# Enrico Fasoli (fazo96) +# Leonardo Magon +# Gabriele Della Torre +# + module.exports = (robot) -> # Ringraziamenti ringr = ['prego :)', "non c'è di che", "faccio solo il mio lavoro", "no problemo amigo", "non fate complimenti ;)"] @@ -9,7 +32,7 @@ module.exports = (robot) -> robot.respond /ringraziamenti/i, (res) -> res.send 'voi teneroni mi avete ringraziato ' + (robot.brain.get('ringraziato') or 0) + ' volte :)' # Richiami - robot.respond /sei (?:(?:proprio|davvero|veramente) )?(.+)/i, (res) -> + robot.respond /sei (?:(?:proprio|davvero|veramente|molto|un|una) )?(.+)/i, (res) -> nomi = robot.brain.get('nomi') or {} nomi[res.match[1]] ?= 0 nomi[res.match[1]] += 1 diff --git a/scripts/tempo.coffee b/scripts/tempo.coffee index 5014154..56ef6b7 100644 --- a/scripts/tempo.coffee +++ b/scripts/tempo.coffee @@ -1,3 +1,18 @@ +# Description: +# utilità varie per gli orari e le date +# +# Dependencies: +# "moment": "2.10.2" +# +# Configuration: +# None +# +# Commands: +# hubot che ore sono? - stampa informazioni su questo momento +# +# Author: +# Enrico Fasoli (fazo96) + moment = require 'moment' module.exports = (robot) ->