Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 24 lines (21 sloc) 0.531 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# Description:
# Insert Pictures of Magic: The Gathering Cards
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot cast <card name> - a picture of the named magic card
#
# Author:
# djljr

querystring = require 'querystring';

module.exports = (robot) ->
  robot.respond /cast (.+)/i, (msg) ->
    url = "http://gatherer.wizards.com/Handlers/Image.ashx"
    card = msg.match[1] || "Dismal%20Failure"
    query = { type: "card", name: card }
    msg.send "#{url}?#{querystring.stringify(query)}#.jpg"
Something went wrong with that request. Please try again.