diff --git a/scripts/stallman-bomb.coffee b/scripts/stallman-bomb.coffee index 51b1096..ade610c 100644 --- a/scripts/stallman-bomb.coffee +++ b/scripts/stallman-bomb.coffee @@ -10,13 +10,14 @@ cheerio = require 'cheerio' +url = 'https://stallman.org/photos/rms-working/mid/' + module.exports = (robot) -> robot.respond /stallbomb( (\d+))?/i, (res) -> n = parseInt res.match[2] || 10 - url = 'https://stallman.org/photos/rms-working/mid/' + robot.http(url).get() (err, _, body) -> - if err then return callback err, {} - + if err then return res.send 'error: stallman is not amused' $ = cheerio.load body links = (url+$(i).attr 'href' for i in $('a') when $(i).attr('href')[0..2] is 'mid') - res.send (res.random links for _ in [0..n]).join '\n' \ No newline at end of file + res.send res.random links for _ in [1..n] \ No newline at end of file