summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-12-31 09:44:06 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-12-31 09:44:06 +0100
commitf4423de9f8da6000a6ff42f6a81c3295b18d9e67 (patch)
tree87f26e82359f463ace515b4b5efe49efe676978c /modules
parent27b39b805ed823212ba7f8850531e9ebae31be35 (diff)
downloadlain-f4423de9f8da6000a6ff42f6a81c3295b18d9e67.tar
lain-f4423de9f8da6000a6ff42f6a81c3295b18d9e67.zip
Implement module system and DDate module
Diffstat (limited to 'modules')
-rw-r--r--modules/DDate.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/DDate.rb b/modules/DDate.rb
new file mode 100644
index 0000000..1402648
--- /dev/null
+++ b/modules/DDate.rb
@@ -0,0 +1,19 @@
+require 'xmpp4r/message'
+
+require_relative '../module_base'
+
+module Lain
+ module Modules
+ class DDate < Base
+ def on_message(muc, message)
+ return unless message.type == :groupchat
+ return unless /!ddate\b/ =~ message.body
+
+ p = IO.popen("ddate")
+ while (line = p.gets)
+ muc.send(Jabber::Message.new(message.to, line.chomp))
+ end
+ end
+ end
+ end
+end