Sha256: 9ae2cf8771ec6868ac4d462586f8f68c0445f12b7139ed3515ff7c3a4dda7247

Contents?: true

Size: 521 Bytes

Versions: 9

Compression:

Stored size: 521 Bytes

Contents

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
boty-0.0.17.1 lib/boty/slack/chat.rb
boty-0.0.17 lib/boty/slack/chat.rb
boty-0.0.16 lib/boty/slack/chat.rb
boty-0.0.15 lib/boty/slack/chat.rb
boty-0.0.14 lib/boty/slack/chat.rb
boty-0.0.13 lib/boty/slack/chat.rb
boty-0.0.12 lib/boty/slack/chat.rb
boty-0.0.11 lib/boty/slack/chat.rb
boty-0.0.10 lib/boty/slack/chat.rb