-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Umang Chouhan
committed
Apr 27, 2012
1 parent
dd6ed62
commit 9698101
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |