summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-28 21:06:29 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-28 21:06:29 +0200
commit3c14c9850e03c679541d3a210e6dcdffeb240044 (patch)
treed4975d645fd8b2cb267253ad0334bdffc1289e7f /lib/rbot/ircbot.rb
parentd5b21e2be33f7d8a3bb471f294a2c88410c84c5f (diff)
ircbot.rb: @bot.topic() can also be used to retrieve topic information instead of setting it
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb10
1 files changed, 8 insertions, 2 deletions
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)