This module sets up a rapid mechanism for people to develop Slacker plugins that call an HTTP end point then render the JSON returned for use in slacker.
So here is a simple scenario, I have an HTTP service that tells me what my IP is:
So with JSON Responder you can build a plugin as follows:
require_relative 'json_responder'
module Slacker
class MyIP < Plugin
include JSONResponder
def help
"slacker myip"
end
def pattern
/myip/i
end
def url_for
'http://jsonip.com'
end
def process_response (result)
result["ip"]
end
Bot.register(MyIP)
end
end
This module sets up a rapid mechanism for people to develop Slacker plugins that call an HTTP end point then render the JSON returned for use in slacker.
So here is a simple scenario, I have an HTTP service that tells me what my IP is:
And when called this is what it returns:
So with JSON Responder you can build a plugin as follows: