this is why you test before comitting.
This commit is contained in:
parent
10e05c91ae
commit
dbdd9a6495
@ -31,13 +31,13 @@ module QuoteSystem
|
||||
event.channel.send_message("##{quote[0]} <#{quote[2]}>: #{quote[3]}")
|
||||
else
|
||||
quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category])
|
||||
if quotes == nil
|
||||
if quotes == []
|
||||
event.channel.send_message("Uh, this is awkward. The category you're trying to get a quote from doesn't exist.")
|
||||
return
|
||||
end
|
||||
else
|
||||
quote = quotes.sample
|
||||
event.channel.send_message("##{quote[0]}: #{quote[3]}")
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user