mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Changed out some try blocks for if/else
This commit is contained in:
parent
749003dab7
commit
b86205ae8b
@ -155,11 +155,11 @@ class FunDB(callbacks.Privmsg):
|
||||
WHERE insult NOT NULL
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
try:
|
||||
(id, insult) = cursor.fetchone()
|
||||
except TypeError:
|
||||
if cursor.rowcount == 0:
|
||||
irc.error(msg, 'There are currently no available insults.')
|
||||
return
|
||||
else:
|
||||
(id, insult) = cursor.fetchone()
|
||||
sql = """UPDATE insults SET use_count=use_count+1, requested_by=%s
|
||||
WHERE id=%s"""
|
||||
cursor.execute(sql, msg.prefix, id)
|
||||
@ -202,11 +202,10 @@ class FunDB(callbacks.Privmsg):
|
||||
WHERE excuse NOTNULL
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
try:
|
||||
(id, excuse) = cursor.fetchone()
|
||||
except TypeError:
|
||||
if cursor.rowcount == 0:
|
||||
irc.error(msg, 'There are currently no available excuses.')
|
||||
return
|
||||
else:
|
||||
(id, excuse) = cursor.fetchone()
|
||||
sql = """UPDATE excuses SET use_count=use_count+1, requested_by=%s
|
||||
WHERE id=%s"""
|
||||
cursor.execute(sql, msg.prefix, id)
|
||||
@ -362,11 +361,10 @@ class FunDB(callbacks.Privmsg):
|
||||
WHERE lart NOTNULL
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
try:
|
||||
(id, lart) = cursor.fetchone()
|
||||
except TypeError:
|
||||
if cursor.rowcount == 0:
|
||||
irc.error(msg, 'There are currently no available larts.')
|
||||
return
|
||||
else:
|
||||
(id, lart) = cursor.fetchone()
|
||||
sql = """UPDATE larts SET use_count=use_count+1, requested_by=%s
|
||||
WHERE id=%s"""
|
||||
cursor.execute(sql, msg.prefix, id)
|
||||
@ -390,11 +388,10 @@ class FunDB(callbacks.Privmsg):
|
||||
WHERE praise NOTNULL
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
try:
|
||||
(id, praise) = cursor.fetchone()
|
||||
except TypeError:
|
||||
if cursor.rowcount == 0:
|
||||
irc.error(msg, 'There are currently no available praises.')
|
||||
return
|
||||
else:
|
||||
(id, praise) = cursor.fetchone()
|
||||
sql = """UPDATE praises SET use_count=use_count+1, requested_by=%s
|
||||
WHERE id=%s"""
|
||||
cursor.execute(sql, msg.prefix, id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user