mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-28 13:42:36 +01:00
preserve usage count upon overwriting an existing regexp entry.
This commit is contained in:
parent
910ba732d2
commit
adb53a0a35
@ -159,12 +159,13 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
etc. being interpolated from the regexp match groups."""
|
||||
db = self.getDb(channel)
|
||||
cursor = db.cursor()
|
||||
cursor.execute("SELECT id, locked FROM triggers WHERE regexp=?", (regexp,))
|
||||
cursor.execute("SELECT id, usage_count, locked FROM triggers WHERE regexp=?", (regexp,))
|
||||
results = cursor.fetchall()
|
||||
if len(results) != 0:
|
||||
(id, locked) = map(int, results[0])
|
||||
(id, usage_count, locked) = map(int, results[0])
|
||||
else:
|
||||
locked = False
|
||||
locked = 0
|
||||
usage_count = 0
|
||||
if not locked:
|
||||
if ircdb.users.hasUser(msg.prefix):
|
||||
name = ircdb.users.getUser(msg.prefix).name
|
||||
@ -172,7 +173,7 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
name = msg.nick
|
||||
cursor.execute("""INSERT INTO triggers VALUES
|
||||
(NULL, ?, ?, ?, ?, ?, ?)""",
|
||||
(regexp, name, int(time.time()), 0, action, 0,))
|
||||
(regexp, name, int(time.time()), usage_count, action, locked,))
|
||||
db.commit()
|
||||
irc.replySuccess()
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user