]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
config botmodule: support CTCP commands VERSION and SOURCE
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 2 Sep 2007 07:16:33 +0000 (07:16 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 2 Sep 2007 07:16:33 +0000 (07:16 +0000)
lib/rbot/core/config.rb

index 7ff7a88c96d02fc2e38dcc063e739f08339960f1..717408a23e286d215f88ee91672467a165468186 100644 (file)
@@ -178,6 +178,18 @@ class ConfigModule < CoreBotModule
     m.reply version_string\r
   end\r
 \r
+  def ctcp_listen(m)\r
+    who = m.private? ? "me" : m.target\r
+    case m.ctcp.intern\r
+    when :VERSION\r
+      m.ctcp_reply version_string\r
+      @bot.irclog "@ #{m.source} asked #{who} about version info"\r
+    when :SOURCE\r
+      m.ctcp_reply Irc::Bot::SOURCE_URL\r
+      @bot.irclog "@ #{m.source} asked #{who} about source info"\r
+    end\r
+  end\r
+\r
   def handle_help(m, params)\r
     m.reply help(params[:topic])\r
   end\r