From 9d1555604557b7ca385869a6fcebaf4dc0665059 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 1 Jan 2013 18:34:23 +0100 Subject: Add credits module, more core improvements --- modules/Credits.rb | 17 +++++++++++++++++ modules/DDate.rb | 5 +---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 modules/Credits.rb (limited to 'modules') 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 -- cgit v1.2.3