]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
ircbot.rb: @bot.topic() can also be used to retrieve topic information instead of...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 28 Jun 2008 19:06:29 +0000 (21:06 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 28 Jun 2008 19:06:29 +0000 (21:06 +0200)
lib/rbot/ircbot.rb

index 8be9cb5ff5b656d1e513fc1af8d746c3ce31eaba..403f496d4a2fcc54e52696cc2df4a24e146cd573 100644 (file)
@@ -1054,8 +1054,14 @@ class Bot
   end
 
   # set topic of channel +where+ to +topic+
-  def topic(where, topic)
-    sendq "TOPIC #{where} :#{topic}", where, 2
+  # can also be used to retrieve the topic of channel +where+
+  # by omitting the last argument
+  def topic(where, topic=nil)
+    if topic.nil?
+      sendq "TOPIC #{where}", where, 2
+    else
+      sendq "TOPIC #{where} :#{topic}", where, 2
+    end
   end
 
   def disconnect(message=nil)