make it so that you can get a random quote if you don't specify a category
This commit is contained in:
parent
a1d25336b7
commit
945e4fb44e
2
bot.rb
2
bot.rb
@ -15,7 +15,7 @@ end
|
|||||||
bot.command :help do |event, *message|
|
bot.command :help do |event, *message|
|
||||||
event.author.pm("You've asked for help. In order not to flood the channel where you sent the command, I have sent the list of commands here, in your PMs. Enjoy!
|
event.author.pm("You've asked for help. In order not to flood the channel where you sent the command, I have sent the list of commands here, in your PMs. Enjoy!
|
||||||
|
|
||||||
**Quote system**\n```;quote <category> - displays a quote from the category\n;addquote <category> <quote> - adds a quote into a category\n;quotecategories - shows all categories\n;showquote <id> - shows the quote with the id provided```
|
**Quote system**\n```;quote <category (optional)> - displays a quote from the category\n;addquote <category> <quote> - adds a quote into a category\n;quotecategories - shows all categories\n;showquote <id> - shows the quote with the id provided```
|
||||||
**Networking related commands**\n```;ip <ips> - Display basic information about an IP address. You can input multiple IPs. We are required to state that the information provided by this command comes from the IP2Location database.```
|
**Networking related commands**\n```;ip <ips> - Display basic information about an IP address. You can input multiple IPs. We are required to state that the information provided by this command comes from the IP2Location database.```
|
||||||
|
|
||||||
")
|
")
|
||||||
|
@ -26,13 +26,16 @@ module QuoteSystem
|
|||||||
command :quote do |event, *message|
|
command :quote do |event, *message|
|
||||||
category = message[0]
|
category = message[0]
|
||||||
if category == nil
|
if category == nil
|
||||||
event.channel.send_message("You haven't specified a category from where to fetch a random quote!")
|
quotes = db.execute("SELECT * FROM quotes")
|
||||||
return
|
quote = quotes.sample
|
||||||
|
event.channel.send_message("##{quote[0]} <#{quote[2]}>: #{quote[3]}")
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category])
|
||||||
|
quote = quotes.sample
|
||||||
|
event.channel.send_message("##{quote[0]}: #{quote[3]}")
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category])
|
|
||||||
quote = quotes.sample
|
|
||||||
event.channel.send_message("##{quote[0]}: #{quote[3]}")
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
command :quotecategories do |event, *message|
|
command :quotecategories do |event, *message|
|
||||||
|
Loading…
Reference in New Issue
Block a user