require 'xmpp4r/message' require_relative '../module_base' module Lain module Modules class Fortune < Base def on_message(muc, message) return unless /\A!fortune\b/ =~ message.body muc.say("\nBEGIN FORTUNE COOKIE\n" + IO.popen(@config[:command]).read.chomp + "\nEND FORTUNE COOKIE") end def commands { '!fortune' => 'fortune cookies' } end end end end