From 0e85323ea683c66cbb6b94d6cda004b6a50dcb3c Mon Sep 17 00:00:00 2001 From: fzorb Date: Sat, 5 Oct 2024 08:06:45 +0300 Subject: [PATCH] make it so that you can get a random quote if you don't specify a category --- systems/quote.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/systems/quote.rb b/systems/quote.rb index 91a7ba2..6e11571 100644 --- a/systems/quote.rb +++ b/systems/quote.rb @@ -19,12 +19,12 @@ module QuoteSystem category = message[0] quote = message[1..].join(" ") event.channel.send_message("I'm adding the quote '#{quote}' under the category #{category}") - db.execute("INSERT INTO quotes (author, category, quote) VALUES (?, ?, ?)", [event.author.id, category, quote]) + db.execute("INSERT INTO quotes (author, category, quote) VALUES (?, ?, ?)", [event.author.id, category.downcase, quote]) nil end command :quote do |event, *message| - category = message[0] + category = message[0].downcase if category == nil quotes = db.execute("SELECT * FROM quotes") quote = quotes.sample