make it so that you can get a random quote if you don't specify a category

This commit is contained in:
fzorb 2024-10-05 08:06:45 +03:00
parent 945e4fb44e
commit 0e85323ea6

View File

@ -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