mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
Made increase/decrease karma stuff work more like moobot (i.e., require a prefixchar and disallow spaces)
This commit is contained in:
parent
d73abebb36
commit
eb7b696ce9
@ -319,24 +319,20 @@ class ChannelDB(callbacks.PrivmsgCommandAndRegexp, ChannelDBHandler):
|
||||
irc.reply(msg, s)
|
||||
|
||||
def increaseKarma(self, irc, msg, match):
|
||||
r"^(.)(.*)\+\+$"
|
||||
(first, rest) = match.groups()
|
||||
if first in conf.prefixChars:
|
||||
name = rest
|
||||
else:
|
||||
name = first + rest
|
||||
r"^(.)(\S+)\+\+$"
|
||||
(first, name) = match.groups()
|
||||
if first not in conf.prefixChars:
|
||||
return
|
||||
db = self.getDb(msg.args[0])
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
||||
cursor.execute("""UPDATE karma SET added=added+1 WHERE name=%s""",name)
|
||||
|
||||
def decreaseKarma(self, irc, msg, match):
|
||||
r"^(.)(.*)--$"
|
||||
(first, rest) = match.groups()
|
||||
if first in conf.prefixChars:
|
||||
name = rest
|
||||
else:
|
||||
name = first + rest
|
||||
r"^(.)(\S+)--$"
|
||||
(first, name) = match.groups()
|
||||
if first not in conf.prefixChars:
|
||||
return
|
||||
db = self.getDb(msg.args[0])
|
||||
cursor = db.cursor()
|
||||
cursor.execute("""INSERT INTO karma VALUES (NULL, %s, 0, 0)""", name)
|
||||
|
Loading…
Reference in New Issue
Block a user