From: Giuseppe Bilotta Date: Sat, 28 Jun 2008 19:06:29 +0000 (+0200) Subject: ircbot.rb: @bot.topic() can also be used to retrieve topic information instead of... X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=3c14c9850e03c679541d3a210e6dcdffeb240044;hp=d5b21e2be33f7d8a3bb471f294a2c88410c84c5f;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git ircbot.rb: @bot.topic() can also be used to retrieve topic information instead of setting it --- diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 8be9cb5f..403f496d 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -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)