-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlolz.coffee
More file actions
30 lines (23 loc) · 985 Bytes
/
lolz.coffee
File metadata and controls
30 lines (23 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# lulz - BRING THE LOLZ from bukk.it
Select = require("soupselect").select
HtmlParser = require "htmlparser"
module.exports = (robot) ->
robot.respond /l[ou]lz$/i, (msg) ->
msg.http("http://bukk.it")
.get() (err, res, body) ->
handler = new HtmlParser.DefaultHandler()
parser = new HtmlParser.Parser handler
parser.parseComplete body
results = ("http://bukk.it/#{link.attribs.href}" for link in Select handler.dom, "td a")
msg.send msg.random results
robot.respond /l[ou]lz\s*bomb (\d+)?/i, (msg) ->
count = msg.match[1] || 5
count = 5 if count > 20
msg.http("http://bukk.it")
.get() (err, res, body) ->
handler = new HtmlParser.DefaultHandler()
parser = new HtmlParser.Parser handler
parser.parseComplete body
results = ("http://bukk.it/#{link.attribs.href}" for link in Select handler.dom, "td a")
for num in [count..1]
msg.send msg.random results