From 09e925d6956cd7431a3466d8b659a7207e029617 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Jan 2013 19:03:27 +0100 Subject: Add Fortune module --- modules/Fortune.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/Fortune.rb (limited to 'modules') diff --git a/modules/Fortune.rb b/modules/Fortune.rb new file mode 100644 index 0000000..2b9d63b --- /dev/null +++ b/modules/Fortune.rb @@ -0,0 +1,16 @@ +require 'xmpp4r/message' + +require_relative '../module_base' + +module Lain + module Modules + class Fortune < Base + def on_message(muc, message) + return unless message.type == :groupchat + return unless /!fortune\b/ =~ message.body + + muc.send(Jabber::Message.new(message.to, IO.popen(@config['command']).gets(sep=nil).chomp)) + end + end + end +end -- cgit v1.2.3