Permalink
Browse files
Cleaning up the revert mess i made
- Loading branch information...
Showing
with
5 additions
and
5 deletions.
-
+1
−1
scripts/chatter.coffee
-
+4
−2
scripts/url.coffee
-
+0
−2
test/chatter.coffee
|
|
@@ -125,7 +125,7 @@ module.exports = (bot) -> |
|
|
bot.fetchJSON url.replace(/%20/g,'+'), (result) ->
|
|
|
if result.pagination.total_count > 0
|
|
|
gif = "#{result.data[0].id}.gif"
|
|
|
- r.reply " http://i.giphy.com/#{gif}"
|
|
|
+ r.reply "http://i.giphy.com/#{gif}"
|
|
|
else
|
|
|
r.reply "No gif available :("
|
|
|
|
|
|
|
|
|
@@ -1,13 +1,15 @@ |
|
|
module.exports = (bot) ->
|
|
|
|
|
|
- is_url = /^(https?):\/\/.+/
|
|
|
+ is_url = /(?:^https?:\/\/|^(www\.?)).+/
|
|
|
|
|
|
resolve = (url, cb)->
|
|
|
if is_url.test url
|
|
|
+ if url.substring(0,3) == "www"
|
|
|
+ url = "http://" + url
|
|
|
bot.fetchHTML url, ($)->
|
|
|
if $
|
|
|
stack = []
|
|
|
- stack.push $("title").text()
|
|
|
+ stack.push $("title").text().replace(/\s\s+/g, "")
|
|
|
opis = $("meta[name=description]").attr("content")
|
|
|
if opis
|
|
|
stack.push opis
|
|
|
|
|
|
@@ -10,14 +10,12 @@ describe 'chatter.coffee', -> |
|
|
|
|
|
it 'test .rainbow love', (done)->
|
|
|
bot.test ".rainbow love", (msg)->
|
|
|
- console.log(msg)
|
|
|
expect(msg).to.be.a('string')
|
|
|
done()
|
|
|
|
|
|
it 'test .gif get lucky', (done)->
|
|
|
bot.test ".gif get lucky", (msg)->
|
|
|
expect(msg).to.be.a('string')
|
|
|
- console.log msg
|
|
|
done()
|
|
|
|
|
|
it 'test spread some love', (done)->
|
|
|
|
0 comments on commit
997d438