module Boty module Slack class Chat include Slack::URL url "https://slack.com/api/chat.postMessage" def im; @im ||= IM.new end def post_message(message, parameters = {}) defaults = { as_user: true, channel: "general", text: message } URL.get parameterize(defaults.merge parameters) end def post_im(user, message) channel = im.open user post_message message, channel: channel.id end end end end