Add stallbomb
This commit is contained in:
parent
283cca28c0
commit
07c75c0cf8
22
scripts/stallman-bomb.coffee
Normal file
22
scripts/stallman-bomb.coffee
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Description:
|
||||||
|
# send pictures of Richard Stallman computing across the world
|
||||||
|
#
|
||||||
|
# Commands
|
||||||
|
# hubot stallbomb ... - spam the chat with Richard Stallman
|
||||||
|
#
|
||||||
|
# Author:
|
||||||
|
# Michele Guerini Rocco (rnhmjoj)
|
||||||
|
#
|
||||||
|
|
||||||
|
cheerio = require 'cheerio'
|
||||||
|
|
||||||
|
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, {}
|
||||||
|
|
||||||
|
$ = 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'
|
Loading…
Reference in New Issue
Block a user