lib/boty/slack/chat.rb in boty-0.0.9 vs lib/boty/slack/chat.rb in boty-0.0.10

- old
+ new

@@ -2,16 +2,23 @@ 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