Send image individually
This commit is contained in:
parent
07c75c0cf8
commit
9b01a17a69
@ -10,13 +10,14 @@
|
|||||||
|
|
||||||
cheerio = require 'cheerio'
|
cheerio = require 'cheerio'
|
||||||
|
|
||||||
|
url = 'https://stallman.org/photos/rms-working/mid/'
|
||||||
|
|
||||||
module.exports = (robot) ->
|
module.exports = (robot) ->
|
||||||
robot.respond /stallbomb( (\d+))?/i, (res) ->
|
robot.respond /stallbomb( (\d+))?/i, (res) ->
|
||||||
n = parseInt res.match[2] || 10
|
n = parseInt res.match[2] || 10
|
||||||
url = 'https://stallman.org/photos/rms-working/mid/'
|
|
||||||
robot.http(url).get() (err, _, body) ->
|
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
|
$ = cheerio.load body
|
||||||
links = (url+$(i).attr 'href' for i in $('a') when $(i).attr('href')[0..2] is 'mid')
|
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'
|
res.send res.random links for _ in [1..n]
|
Loading…
Reference in New Issue
Block a user