Some code refactoring (use of class instead of tuples)

This commit is contained in:
Némunaire 2012-04-11 17:33:57 +02:00
parent 448b455e77
commit 4f0744ab24
8 changed files with 333 additions and 200 deletions

View file

@ -154,15 +154,12 @@ class Message:
def parsemsg (self, mods):
if re.match(".*(norme|coding style).*", self.content) is not None and re.match(".*(please|give|obtenir|now|plz|stp|svp|s'il (te|vous) pla.t|check).*", self.content) is not None:
norme.launch (self.srv.s, self.sender, self.content)
#Treat all messages starting with 'nemubot:' as distinct commands
elif self.content.find("%s:"%self.srv.nick) == 0:
if self.content.find("%s:"%self.srv.nick) == 0:
messagel = self.content.lower()
#Is it a simple response?
if re.match(".*(m[' ]?entends?[ -]+tu|h?ear me|do you copy|ping).*", messagel) is not None:
if re.match(".*(m[' ]?entends?[ -]+tu|h?ear me|do you copy|ping)", messagel) is not None:
self.send_chn ("%s: pong"%(self.sender))
elif re.match(".*di[st] (a|à) ([a-zA-Z0-9_]+) (.+)$", messagel) is not None: