remove overload of on_pubmsg()

This commit is contained in:
Brian S. Stephan 2010-09-08 20:44:09 -05:00
parent 54af309bbc
commit e6c9747dad
1 changed files with 1 additions and 35 deletions

View File

@ -27,47 +27,13 @@ from Module import Module
# they last said something.
class Seen(Module):
# Overriding the default because we need stuff to occur before the addressed
# and so on checks.
def on_pubmsg(self, connection, event):
nick = irclib.nm_to_n(event.source())
userhost = irclib.nm_to_uh(event.source())
replypath = event.target()
what = event.arguments()[0]
admin_unlocked = False
def do(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
# whatever it is, store it
if not self.config.has_section(self.__class__.__name__):
self.config.add_section(self.__class__.__name__)
self.config.set(self.__class__.__name__, nick, userhost + '|:|' + datetime.utcnow().isoformat() + '|:|' + what)
try:
if userhost == self.config.get('dr.botzo', 'admin_userhost'):
admin_unlocked = True
except NoOptionError: pass
# only do commands if the bot has been addressed directly
addressed_pattern = '^' + connection.get_nickname() + '[:,]?\s+'
addressed_re = re.compile(addressed_pattern)
if not addressed_re.match(what):
return
else:
what = addressed_re.sub('', what)
if replypath is not None:
what = self.try_recursion(connection, event, nick, userhost, replypath, what, admin_unlocked)
# try reloading
self.reload(connection, event, nick, userhost, replypath, what, admin_unlocked)
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
def do(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
whats = what.split(' ')
if whats[0] == 'seen' and len(whats) >= 2:
query = whats[1]