if the category doesn't exist, give an error instead of not replying

This commit is contained in:
fzorb 2024-10-05 08:14:26 +03:00
parent 0e85323ea6
commit 10e05c91ae

View File

@ -29,13 +29,16 @@ module QuoteSystem
quotes = db.execute("SELECT * FROM quotes")
quote = quotes.sample
event.channel.send_message("##{quote[0]} <#{quote[2]}>: #{quote[3]}")
nil
else
quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category])
if quotes == nil
event.channel.send_message("Uh, this is awkward. The category you're trying to get a quote from doesn't exist.")
return
end
quote = quotes.sample
event.channel.send_message("##{quote[0]}: #{quote[3]}")
nil
end
nil
end
command :quotecategories do |event, *message|