From d2bdf50753338cde9cdb806f912a822344d7097a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 30 Jul 2008 19:25:24 +0200 Subject: + @bot.wanted_nick stores the nick wanted by the bot --- lib/rbot/ircbot.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/rbot/ircbot.rb') 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]) -- cgit v1.2.3