make it so that you can get a random quote if you don't specify a category
This commit is contained in:
parent
945e4fb44e
commit
0e85323ea6
@ -19,12 +19,12 @@ module QuoteSystem
|
|||||||
category = message[0]
|
category = message[0]
|
||||||
quote = message[1..].join(" ")
|
quote = message[1..].join(" ")
|
||||||
event.channel.send_message("I'm adding the quote '#{quote}' under the category #{category}")
|
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
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
command :quote do |event, *message|
|
command :quote do |event, *message|
|
||||||
category = message[0]
|
category = message[0].downcase
|
||||||
if category == nil
|
if category == nil
|
||||||
quotes = db.execute("SELECT * FROM quotes")
|
quotes = db.execute("SELECT * FROM quotes")
|
||||||
quote = quotes.sample
|
quote = quotes.sample
|
||||||
|
Loading…
Reference in New Issue
Block a user