class QbertBot::Message

Attributes

channel_id[RW]
channel_name[RW]
matches[RW]
raw_text[RW]
team_id[RW]
timestamp[RW]
token[RW]
trigger_word[RW]
user_id[RW]
user_name[RW]

Public Class Methods

new(bot, post_data) click to toggle source
# File lib/qbert_bot/message.rb, line 7
def initialize(bot, post_data)
  @bot = bot
  [:token, :team_id, :channel_id, :channel_name, :timestamp,
   :user_id, :user_name, :trigger_word].each do |k|
    send("#{k.to_s}=", post_data[k])
  end
  self.raw_text = post_data[:text]
end

Public Instance Methods

reply(text, opts = {}) click to toggle source
# File lib/qbert_bot/message.rb, line 20
def reply(text, opts = {})
  say(channel_name, text, opts)
end
say(*args) click to toggle source
# File lib/qbert_bot/message.rb, line 16
def say(*args)
  @bot.say(*args)
end
text() click to toggle source
# File lib/qbert_bot/message.rb, line 24
def text
  raw_text.sub(trigger_word, '').strip
end