class Server
eventmachine engine for serving as a webhook destination
Public Class Methods
new(bot)
click to toggle source
# File lib/cogbot/server.rb, line 5 def initialize(bot) @bot = bot end
Public Instance Methods
post_init()
click to toggle source
Calls superclass method
# File lib/cogbot/server.rb, line 9 def post_init super no_environment_strings end
process_http_request()
click to toggle source
# File lib/cogbot/server.rb, line 14 def process_http_request if @http_request_method == "POST" pluginlist = @bot.plugins.map { |e| e.class.name.split('::').last.downcase } query = @http_request_uri[1..-1] if pluginlist.include? query @bot.handlers.dispatch("http_#{query}".to_sym, nil, @http_post_content) end end response = EM::DelegatedHttpResponse.new(self) response.status = 200 response.send_response end