mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Fixed the self-lart bug.
This commit is contained in:
parent
581dcda8e0
commit
cdda36f9fb
@ -405,13 +405,13 @@ class FunDB(callbacks.Privmsg):
|
|||||||
id = 0
|
id = 0
|
||||||
if not nick:
|
if not nick:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
|
if nick == irc.nick:
|
||||||
|
nick = msg.nick
|
||||||
try:
|
try:
|
||||||
(nick, reason) = imap(' '.join,
|
(nick, reason) = imap(' '.join,
|
||||||
utils.itersplit('for'.__eq__, nick.split(), 1))
|
utils.itersplit('for'.__eq__, nick.split(), 1))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
reason = ''
|
reason = ''
|
||||||
|
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
if id:
|
if id:
|
||||||
cursor.execute("""SELECT id, lart FROM larts WHERE id=%s""", id)
|
cursor.execute("""SELECT id, lart FROM larts WHERE id=%s""", id)
|
||||||
@ -456,13 +456,11 @@ class FunDB(callbacks.Privmsg):
|
|||||||
id = 0
|
id = 0
|
||||||
if not nick:
|
if not nick:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
|
|
||||||
try:
|
try:
|
||||||
(nick, reason) = imap(' '.join,
|
(nick, reason) = imap(' '.join,
|
||||||
utils.itersplit('for'.__eq__, nick.split(), 1))
|
utils.itersplit('for'.__eq__, nick.split(), 1))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
reason = ''
|
reason = ''
|
||||||
|
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
if id:
|
if id:
|
||||||
cursor.execute("""SELECT id, praise FROM praises WHERE id=%s""",id)
|
cursor.execute("""SELECT id, praise FROM praises WHERE id=%s""",id)
|
||||||
@ -474,7 +472,6 @@ class FunDB(callbacks.Privmsg):
|
|||||||
WHERE praise NOTNULL
|
WHERE praise NOTNULL
|
||||||
ORDER BY random()
|
ORDER BY random()
|
||||||
LIMIT 1""")
|
LIMIT 1""")
|
||||||
|
|
||||||
if cursor.rowcount == 0:
|
if cursor.rowcount == 0:
|
||||||
irc.error(msg, 'There are currently no available praises.')
|
irc.error(msg, 'There are currently no available praises.')
|
||||||
else:
|
else:
|
||||||
@ -524,6 +521,7 @@ class FunDB(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
irc.reply(msg, 'That word has no anagrams that I know of.')
|
irc.reply(msg, 'That word has no anagrams that I know of.')
|
||||||
|
|
||||||
|
|
||||||
Class = FunDB
|
Class = FunDB
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ if sqlite is not None:
|
|||||||
self.assertResponse('lart 2 jemfinch for being dumb',
|
self.assertResponse('lart 2 jemfinch for being dumb',
|
||||||
'\x01ACTION shoots jemfinch for being dumb '
|
'\x01ACTION shoots jemfinch for being dumb '
|
||||||
'(#2)\x01')
|
'(#2)\x01')
|
||||||
|
self.assertNotRegexp('lart %s' % self.irc.nick, self.irc.nick)
|
||||||
self.assertNotError('remove lart 1')
|
self.assertNotError('remove lart 1')
|
||||||
self.assertRegexp('num lart', 'currently 1 lart')
|
self.assertRegexp('num lart', 'currently 1 lart')
|
||||||
self.assertResponse('lart jemfinch',
|
self.assertResponse('lart jemfinch',
|
||||||
|
Loading…
Reference in New Issue
Block a user