this is why you test before comitting.

This commit is contained in:
fzorb 2024-10-05 08:16:11 +03:00
parent 10e05c91ae
commit dbdd9a6495

View File

@ -31,12 +31,12 @@ 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
else
quote = quotes.sample
event.channel.send_message("##{quote[0]}: #{quote[3]}")
end
quote = quotes.sample
event.channel.send_message("##{quote[0]}: #{quote[3]}")
end
nil
end