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

Commit f72b9ac

Browse files
Merge pull request #1292 from Dahaden/master
Steam now gives 2 messages to allow images to appear in some chats
2 parents 95fbe6d + 4859d65 commit f72b9ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/scripts/steam.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ Select = require("soupselect").select
2323
HTMLParser = require "htmlparser"
2424
sanitize = require('validator').sanitize
2525

26-
2726
module.exports = (robot) ->
2827
robot.respond /daily deal/i, (msg) ->
29-
getDeals msg, (responseText) ->
30-
msg.send responseText
31-
28+
getDeals msg, (deal) ->
29+
msg.send deal[0], deal[1]
3230

3331
getDeals = (msg, callback) ->
3432
location = "http://store.steampowered.com"
@@ -45,7 +43,9 @@ parseDeals = (body, selector) ->
4543
if dealObj?
4644
originalPrice = Select(handler.dom, '.dailydeal_content .discount_original_price')[0]
4745
finalPrice = Select(handler.dom, '.dailydeal_content .discount_final_price')[0]
48-
deal = "From #{sanitize(originalPrice.children[0].data).entityDecode().trim()} to #{sanitize(finalPrice.children[0].data).entityDecode().trim()} #{dealObj.children[0].attribs.src} #{dealObj.attribs.href}"
46+
image = "#{dealObj.children[0].attribs.src.replace /[?].*/ , ''}"
47+
deal = "From #{sanitize(originalPrice.children[0].data).entityDecode().trim()} to #{sanitize(finalPrice.children[0].data).entityDecode().trim()} #{dealObj.attribs.href}"
48+
response = [image, deal]
4949
else
5050
msg.send "No daily deal found"
5151

0 commit comments

Comments
 (0)