summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-01-01 18:34:23 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-01-01 18:34:23 +0100
commit9d1555604557b7ca385869a6fcebaf4dc0665059 (patch)
tree6269c57f48331f1704907b633d7a3660b3a647a1 /modules
parent0b95e32f2f9f21ad288bc53f2423c135532b933e (diff)
downloadlain-9d1555604557b7ca385869a6fcebaf4dc0665059.tar
lain-9d1555604557b7ca385869a6fcebaf4dc0665059.zip
Add credits module, more core improvements
Diffstat (limited to 'modules')
-rw-r--r--modules/Credits.rb17
-rw-r--r--modules/DDate.rb5
2 files changed, 18 insertions, 4 deletions
diff --git a/modules/Credits.rb b/modules/Credits.rb
new file mode 100644
index 0000000..e0289e4
--- /dev/null
+++ b/modules/Credits.rb
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+require 'xmpp4r/message'
+
+require_relative '../module_base'
+
+module Lain
+ module Modules
+ class Credits < Base
+ def on_message(muc, message)
+ return unless message.type == :groupchat
+ return unless /!credits\b/ =~ message.body
+
+ muc.send(Jabber::Message.new(message.to, "Lain (レイン) #{Version}\n\n -- hacked by NeoRaider"))
+ end
+ end
+ end
+end
diff --git a/modules/DDate.rb b/modules/DDate.rb
index 1402648..af9912e 100644
--- a/modules/DDate.rb
+++ b/modules/DDate.rb
@@ -9,10 +9,7 @@ module Lain
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
+ muc.send(Jabber::Message.new(message.to, IO.popen("ddate").gets(sep=nil).chomp))
end
end
end