mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Made sure no prefixchars got into the karma table.
This commit is contained in:
parent
1342a76b95
commit
95f5abdda4
@ -304,18 +304,26 @@ class ChannelDB(callbacks.PrivmsgCommandAndRegexp, ChannelDBHandler):
|
|||||||
total))
|
total))
|
||||||
|
|
||||||
def increaseKarma(self, irc, msg, match):
|
def increaseKarma(self, irc, msg, match):
|
||||||
r"^(.*)\+\+$"
|
r"^(.)(.*)\+\+$"
|
||||||
debug.printf('increaseKarma')
|
debug.printf('increaseKarma')
|
||||||
name = match.group(1)
|
(first, rest) = match.groups()
|
||||||
|
if first in conf.prefixChars:
|
||||||
|
name = rest
|
||||||
|
else:
|
||||||
|
name = first + rest
|
||||||
db = self.getDb(msg.args[0])
|
db = self.getDb(msg.args[0])
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
||||||
cursor.execute("""UPDATE karma SET added=added+1 WHERE name=%s""",name)
|
cursor.execute("""UPDATE karma SET added=added+1 WHERE name=%s""",name)
|
||||||
|
|
||||||
def decreaseKarma(self, irc, msg, match):
|
def decreaseKarma(self, irc, msg, match):
|
||||||
r"^(.*)--$"
|
r"^(.)(.*)--$"
|
||||||
debug.printf('decreaseKarma')
|
debug.printf('decreaseKarma')
|
||||||
name = match.group(1)
|
(first, rest) = match.groups()
|
||||||
|
if first in conf.prefixChars:
|
||||||
|
name = rest
|
||||||
|
else:
|
||||||
|
name = first + rest
|
||||||
db = self.getDb(msg.args[0])
|
db = self.getDb(msg.args[0])
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
||||||
|
Loading…
Reference in New Issue
Block a user