class Ruboty::Handlers::LastWords
Public Instance Methods
catchall(message)
click to toggle source
# File lib/ruboty/handlers/last_words.rb, line 7 def catchall(message) words[message.from_name] = { body: message[:keyword], time: Time.new } end
last_words(message)
click to toggle source
# File lib/ruboty/handlers/last_words.rb, line 11 def last_words(message) if last_words = words[message[:username]] header = "#{message[:username]} said..." body = "#{last_words[:body]}\n[#{last_words[:time]}]" message.reply(header) message.reply(body, code: true) else message.reply("#{message[:username]} was forgotten...") end end
Private Instance Methods
words()
click to toggle source
# File lib/ruboty/handlers/last_words.rb, line 24 def words robot.brain.data[Ruboty::LastWords::NAMESPACE] ||= {} end