DrBotIRC: add support for ignoring all events from a nick

rudimentary for the moment. pop something like this in your config:

[Ignore]
nick_to_ignore = 1
This commit is contained in:
Brian S. Stephan 2012-03-01 22:00:42 -06:00
parent 26bc8bec34
commit ef9b80d86f
1 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,19 @@ class DrBotIRC(irclib.IRC):
def _handle_event(self, connection, event):
"""Override event handler to do recursion."""
try:
nick = irclib.nm_to_n(event.source())
except (IndexError, AttributeError):
nick = ''
try:
if self.config.has_section('Ignore'):
alias = self.config.get('Ignore', nick)
if alias:
print("ignoring " + nick + " as per config file")
return
except NoOptionError: pass
self.try_alias_cmds(connection, event)
self.try_recursion(connection, event)
self.try_alias(connection, event)