Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Adding def programming script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Davi Ferreira committed Dec 13, 2011
1 parent a8a9b6a commit f71f489
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/scripts/defprogramming.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# quote me - Display a random programming quote from defprogramming.co

Select = require("soupselect").select
HtmlParser = require "htmlparser"

module.exports = (robot) ->
robot.respond /def programming/i, (msg) ->
msg.http("http://www.defprogramming.com/random")
.get() (err, res, body) ->
handler = new HtmlParser.DefaultHandler()
parser = new HtmlParser.Parser handler

parser.parseComplete body

results = Select handler.dom, "cite a p"
msg.send results[0].children[0].raw

0 comments on commit f71f489

Please sign in to comment.