From 1d33f6d468ba98e5b02f777692208ca62672706a Mon Sep 17 00:00:00 2001 From: fzorb Date: Sat, 5 Oct 2024 08:45:43 +0300 Subject: [PATCH] prevent it from trying to downcase a nil element and failing. --- systems/quote.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/systems/quote.rb b/systems/quote.rb index 59124d7..2b7bf28 100644 --- a/systems/quote.rb +++ b/systems/quote.rb @@ -24,12 +24,13 @@ module QuoteSystem end command :quote do |event, *message| - category = message[0].downcase + category = message[0] if category == nil quotes = db.execute("SELECT * FROM quotes") quote = quotes.sample event.channel.send_message("##{quote[0]} <#{quote[2]}>: #{quote[3]}") else + category = category.downcase quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category]) if quotes == [] event.channel.send_message("Uh, this is awkward. The category you're trying to get a quote from doesn't exist.")