class Slackbotsy::Message

Public Class Methods

new(caller, msg) click to toggle source

convert message from a Hash obj to a Message obj

Calls superclass method
# File lib/slackbotsy/message.rb, line 7
def initialize(caller, msg)
  super()
  self.update(msg)
  @caller = caller          # bot object
  @bot    = caller          # alias for bot object
end

Public Instance Methods

attach(attachments, options = {}) click to toggle source
# File lib/slackbotsy/message.rb, line 24
def attach(attachments, options = {})
  @caller.attach(attachments, { channel: self['channel_name'] }.merge(options))
end
post(options) click to toggle source

convenience wrapper in message scope, so we can call it without @caller and set default channel to same as received message

# File lib/slackbotsy/message.rb, line 16
def post(options)
  @caller.post({ channel: self['channel_name'] }.merge(options))
end
post_message(text, options = {}) click to toggle source
# File lib/slackbotsy/message.rb, line 28
def post_message(text, options = {})
  @caller.post_message(text, { channel: self['channel_name'] }.merge(options))
end
say(text, options = {}) click to toggle source
# File lib/slackbotsy/message.rb, line 20
def say(text, options = {})
  @caller.say(text, { channel: self['channel_name'] }.merge(options))
end
upload(options = {}) click to toggle source
# File lib/slackbotsy/message.rb, line 32
def upload(options = {})
  @caller.upload({ channel: self['channel_name'] }.merge(options))
end