From 575c4c14d527e4dc06e015ffce7aafd6307a7692 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 28 Jan 2009 21:36:38 +0100 Subject: ircbot: irc.ignore_channels config option In some circumstances the user might want to turn the bot into a pure logbot for some channels. This can now be achieved by adding that channel to the irc.ignore_channels config key, that makes the bot ignore all PRIVMSG to that channel (note that notices and service messages such as joins and parts are still acted on, just like for irc.ignore_users). --- lib/rbot/ircbot.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index b47c235b..d5d3828b 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -306,6 +306,9 @@ class Bot Config.register Config::ArrayValue.new('irc.ignore_users', :default => [], :desc => "Which users to ignore input from. This is mainly to avoid bot-wars triggered by creative people") + Config.register Config::ArrayValue.new('irc.ignore_channels', + :default => [], + :desc => "Which channels to ignore input in. This is mainly to turn the bot into a logbot that doesn't interact with users in any way (in the specified channels)") Config.register Config::IntegerValue.new('core.save_every', :default => 60, :validate => Proc.new{|v| v >= 0}, @@ -639,6 +642,11 @@ class Bot # debug "Message target is #{data[:target].inspect}" # debug "Bot is #{myself.inspect}" + @config['irc.ignore_channels'].each { |channel| + if m.target.downcase == channel.downcase + m.ignored = true + end + } @config['irc.ignore_users'].each { |mask| if m.source.matches?(server.new_netmask(mask)) m.ignored = true -- cgit v1.2.3