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