From 25ed9b71564b73b07d664e2396c641ffe74f45b1 Mon Sep 17 00:00:00 2001 From: Brian Sherson Date: Tue, 27 Aug 2013 20:39:32 -0700 Subject: --- sedbot.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sedbot.py') diff --git a/sedbot.py b/sedbot.py index fe34da4..9a23006 100644 --- a/sedbot.py +++ b/sedbot.py @@ -2,11 +2,12 @@ import os, re, time class SED(object): - def __init__(self): + def __init__(self, expiry=1800): self.__name__="SED Bot" self.__version__="0.0.1" + self.expiry=expiry self.history=[] - self.pattern=r"^!s([,/#])((?:.|\\\1)*)\1((?:.|\\\1)*)\1([ig]*)$" + self.pattern=r"^!?s([,/#])((?:.|\\\1)*)\1((?:.|\\\1)*)\1([ig]*)$" def onRecv(self, IRC, line, data): if data==None: return self.replace(IRC, *data) @@ -14,8 +15,11 @@ class SED(object): if origin==self: return #print data (cmd, target, params, extinfo)=data - self.replace(IRC, IRC.identity.nick, IRC.identity.idnt, IRC.identity.host, *data) + if IRC.identity: self.replace(IRC, IRC.identity.nick, IRC.identity.idnt, IRC.identity.host, *data) def replace(self, IRC, origin, ident, host, cmd, target, params, extinfo): + ### Clear out old data that has expired. + while len(self.history) and self.history[0][0]