add showquote & change categories to quotecategories
This commit is contained in:
parent
5f7f603b42
commit
36b2ae7ef3
2
bot.rb
2
bot.rb
@ -13,7 +13,7 @@ bot.message do |event|
|
||||
end
|
||||
|
||||
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! \n\n**Quote system**\n```;quote <category> - displays a quote from the category\n;addquote <category> <quote> - adds a quote into a category\n;categories - shows all categories```")
|
||||
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! \n\n**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```")
|
||||
event.message.delete
|
||||
nil
|
||||
end
|
||||
|
@ -31,9 +31,19 @@ module QuoteSystem
|
||||
nil
|
||||
end
|
||||
|
||||
command :categories do |event, *message|
|
||||
command :quotecategories do |event, *message|
|
||||
categories = db.execute("SELECT DISTINCT category FROM quotes")
|
||||
event.channel.send_message("**Categories**: #{categories[0..].join(' ')}")
|
||||
nil
|
||||
end
|
||||
|
||||
command :showquote do |event, *message|
|
||||
quote = db.execute("SELECT * FROM quotes WHERE id = ?", [message[0]])
|
||||
if quote == nil
|
||||
event.channel.send_message("Quote doesn't exist")
|
||||
return
|
||||
end
|
||||
event.channel.send_message("##{quote[0][0]}: #{quote[0][3]}")
|
||||
nil
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user