mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fix a bugz0r in randomgrabbing
This commit is contained in:
parent
7f00bf01c2
commit
0a1907318a
@ -183,6 +183,7 @@ class SqliteQuoteGrabsDB(object):
|
||||
ORDER BY id DESC LIMIT 1""", nick)
|
||||
if cursor.rowcount == 0:
|
||||
raise dbi.NoRecordError
|
||||
return cursor.fetchone()[0]
|
||||
|
||||
def add(self, msg, by):
|
||||
channel = msg.args[0]
|
||||
@ -223,12 +224,11 @@ class QuoteGrabs(callbacks.Privmsg):
|
||||
if self.registryValue('randomGrabber', channel):
|
||||
if len(payload) > length and len(payload.split()) > words:
|
||||
try:
|
||||
self.db.select(channel, msg.nick)
|
||||
last = self.db.select(channel, msg.nick)
|
||||
except dbi.NoRecordError:
|
||||
self._grab(irc, msg, irc.prefix)
|
||||
self._sendGrabMsg(irc, msg)
|
||||
else:
|
||||
last = int(cursor.fetchone()[0])
|
||||
elapsed = int(time.time()) - last
|
||||
if random.random()*elapsed > grabTime/2:
|
||||
self._grab(irc, msg, irc.prefix)
|
||||
|
Loading…
Reference in New Issue
Block a user