Skip to content
Browse files

Removing jquery dependency in favor of cheerio.

  • Loading branch information...
1 parent 0ef860e commit 719bfca356f90cab47566efd470ac4e04ae65741 @commadelimited commadelimited committed Dec 20, 2012
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/scripts/nickgen.coffee
View
12 src/scripts/nickgen.coffee
@@ -2,8 +2,7 @@
# Nickname generator
#
# Dependencies:
-# "querystring": "0.1.0"
-# "jquery": "1.7.2"
+# "cheerio": "0.10.5"
#
# Configuration:
# None
@@ -23,9 +22,7 @@
# Author:
# @commadelimited
-
-QS = require 'querystring'
-$ = require 'jquery'
+$ = require 'cheerio'
# what nickname do you want?
options =
@@ -65,12 +62,13 @@ module.exports = (robot) ->
name = msg.match[2]
selector = options[type]['selector']
greeting = options[type]['greeting']
- data = QS.stringify({'realname': name})
+ data = "realname="+ name
+ console.log(data)
msg.http(url)
.header("Content-Type", "application/x-www-form-urlencoded")
.post(data) (err, res, body) ->
- response = greeting + $.trim( $(body).find(selector).text().replace('\n','').replace(name,'') )
+ response = greeting + $(body).find(selector).text().replace(/\n/g,'').replace(name,'')
msg.send response
robot.respond /nick help/i, (msg) ->

0 comments on commit 719bfca

Please sign in to comment.
Something went wrong with that request. Please try again.