From 9a1086e855a29bc33763f94397cacec1aacdfab3 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 25 Oct 2010 19:11:17 -0500 Subject: [PATCH] added support for karma for things with spaces, by wrapping it in () e.g.: (this is one really long thing that i like)++ --- modules/Karma.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/Karma.py b/modules/Karma.py index 502cbd7..405c721 100755 --- a/modules/Karma.py +++ b/modules/Karma.py @@ -37,10 +37,10 @@ class Karma(Module): self.karmafile = filename + "_karma.dat" self.trendfile = filename + "_trends.dat" - pattern = "([a-zA-Z0-9_]+)" + pattern = "(?:([a-zA-Z0-9_]+)|\(([a-zA-Z0-9_ ]+)\))" karmapattern = '^' + pattern + '(\+\+|--)' - querypattern = '^!rank\s+' + pattern + querypattern = '^!rank\s+(.*)' self.karmare = re.compile(karmapattern) self.queryre = re.compile(querypattern) @@ -59,8 +59,8 @@ class Karma(Module): handle the karma change and storage. """ match = self.karmare.match(what) - key = match.group(1) - value = match.group(2) + key = match.group(1) if match.group(1) else match.group(2) + value = match.group(3) if (value == '++'): value = 1; else: