added support for karma for things with spaces, by wrapping it in ()
e.g.: (this is one really long thing that i like)++
This commit is contained in:
parent
2973d904f4
commit
9a1086e855
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user