remove overload of on_pubmsg()
This commit is contained in:
parent
54af309bbc
commit
e6c9747dad
@ -27,47 +27,13 @@ from Module import Module
|
|||||||
# they last said something.
|
# they last said something.
|
||||||
|
|
||||||
class Seen(Module):
|
class Seen(Module):
|
||||||
|
def do(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
|
||||||
# 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
|
|
||||||
|
|
||||||
# whatever it is, store it
|
# whatever it is, store it
|
||||||
if not self.config.has_section(self.__class__.__name__):
|
if not self.config.has_section(self.__class__.__name__):
|
||||||
self.config.add_section(self.__class__.__name__)
|
self.config.add_section(self.__class__.__name__)
|
||||||
|
|
||||||
self.config.set(self.__class__.__name__, nick, userhost + '|:|' + datetime.utcnow().isoformat() + '|:|' + what)
|
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(' ')
|
whats = what.split(' ')
|
||||||
if whats[0] == 'seen' and len(whats) >= 2:
|
if whats[0] == 'seen' and len(whats) >= 2:
|
||||||
query = whats[1]
|
query = whats[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user