From dbdd9a64957bca8735a6eb4d658bba0764827486 Mon Sep 17 00:00:00 2001 From: fzorb Date: Sat, 5 Oct 2024 08:16:11 +0300 Subject: [PATCH] this is why you test before comitting. --- systems/quote.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/systems/quote.rb b/systems/quote.rb index 6c12c76..59124d7 100644 --- a/systems/quote.rb +++ b/systems/quote.rb @@ -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