summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-30 19:25:24 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-07-30 19:25:24 +0200
commitd2bdf50753338cde9cdb806f912a822344d7097a (patch)
treea4c4004b65fb15b220b7a11ed8d15f3f262b835e /lib/rbot/ircbot.rb
parent6367bb1e0ec7ecc03ebfc9370a096c2a2c18adae (diff)
+ @bot.wanted_nick stores the nick wanted by the bot
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index f5681338..01dbb12b 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -207,6 +207,22 @@ class Bot
myself.nick
end
+ # nick wanted by the bot. This defaults to the irc.nick config value,
+ # but may be overridden by a manual !nick command
+ def wanted_nick
+ @wanted_nick || config['irc.nick']
+ end
+
+ # set the nick wanted by the bot
+ def wanted_nick=(wn)
+ if wn.nil? or wn.to_s.downcase == config['irc.nick'].downcase
+ @wanted_nick = nil
+ else
+ @wanted_nick = wn.to_s.dup
+ end
+ end
+
+
# bot inspection
# TODO multiserver
def inspect
@@ -584,6 +600,10 @@ class Bot
#
@quiet = Set.new
+ # the nick we want, if it's different from the irc.nick config value
+ # (e.g. as set by a !nick command)
+ @wanted_nick = nil
+
@client[:welcome] = proc {|data|
m = WelcomeMessage.new(self, server, data[:source], data[:target], data[:message])