<commit_before># Description
#   The plugin will provide a picture and a link of the daily deal from Steam
#
# Dependencies:
#   "cheerio": "0.13.1"
#
# Configuration:
#   None
#
# Commands:
#   hubot сделка дня - покажет сделку дня по мниению Steam
#
# Author:
#   illotum

cheerio = require('cheerio')
base = "http://store.steampowered.com"

getItems = (msg, location, parser, limit, callback) ->
  msg.http(location).get() (error,response, body) ->
    return msg.send "Something went wrong..." if error
    items = parser body
    callback items

parseDeals = (body, selector) ->
  $ = cheerio.load(body, {ignoreWhitespace: true})
  deal =
    image: $(".dailydeal img").attr('src').replace /[?].*/ , ''
    url: $(".dailydeal a").attr('href').replace /[?].*/ , ''
    discount: $(".dailydeal_content .discount_pct").text()

module.exports = (robot) ->
  location = base
  robot.respond /daily deal|сделка дня/i, (msg) ->
    getItems msg, location, parseDeals, 1, (deal) ->
      if deal.url
        msg.send "#{deal.discount} // #{deal.url} (#{deal.image})"
      else
        msg.send "Сегодня сделки дня нет"
<commit_msg>try different message format<commit_after># Description
#   The plugin will provide a picture and a link of the daily deal from Steam
#
# Dependencies:
#   "cheerio": "0.13.1"
#
# Configuration:
#   None
#
# Commands:
#   hubot сделка дня - покажет сделку дня по мниению Steam
#
# Author:
#   illotum

cheerio = require('cheerio')
base = "http://store.steampowered.com"

getItems = (msg, location, parser, limit, callback) ->
  msg.http(location).get() (error,response, body) ->
    return msg.send "Something went wrong..." if error
    items = parser body
    callback items

parseDeals = (body, selector) ->
  $ = cheerio.load(body, {ignoreWhitespace: true})
  deal =
    image: $(".dailydeal img").attr('src').replace /[?].*/ , ''
    url: $(".dailydeal a").attr('href').replace /[?].*/ , ''
    discount: $(".dailydeal_content .discount_pct").text()

module.exports = (robot) ->
  location = base
  robot.respond /daily deal|сделка дня/i, (msg) ->
    getItems msg, location, parseDeals, 1, (deal) ->
      if deal.url
        msg.send "#{deal.discount} // #{deal.image} // #{deal.url}"
      else
        msg.send "Сегодня сделки дня нет"

{'fraction_non_alphanumeric': 0.16710642040457344, 'fraction_numerical': 0.0043975373790677225, 'mean_word_length': 3.220779220779221, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4361325', 'n_tokens_mistral': 831, 'n_tokens_neox': 798, 'n_words': 207}