mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 18:44:04 +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)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
def increaseKarma(self, irc, msg, match):
|
def increaseKarma(self, irc, msg, match):
|
||||||
r"^(.)(.*)\+\+$"
|
r"^(.)(\S+)\+\+$"
|
||||||
(first, rest) = match.groups()
|
(first, name) = match.groups()
|
||||||
if first in conf.prefixChars:
|
if first not in conf.prefixChars:
|
||||||
name = rest
|
return
|
||||||
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"^(.)(\S+)--$"
|
||||||
(first, rest) = match.groups()
|
(first, name) = match.groups()
|
||||||
if first in conf.prefixChars:
|
if first not in conf.prefixChars:
|
||||||
name = rest
|
return
|
||||||
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