summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/Fortune.rb16
1 files changed, 16 insertions, 0 deletions
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