update gitignore
This commit is contained in:
parent
93b88dfeb6
commit
9d03e8ed6f
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
.env
|
||||
jon.db
|
||||
jon.sqlite
|
||||
Gemfile.lock
|
||||
|
27
bot.rb
27
bot.rb
@ -14,6 +14,14 @@ bot.message do |event|
|
||||
end
|
||||
|
||||
bot.command :addquote do |event, *message|
|
||||
if message[0] == nil
|
||||
event.channel.send_message("You haven't specified a category for your quote.")
|
||||
return
|
||||
end
|
||||
if message[1] == nil
|
||||
event.channel.send_message("I can't quote air!")
|
||||
return
|
||||
end
|
||||
category = message[0]
|
||||
quote = message[1..].join(" ")
|
||||
event.channel.send_message("I'm adding the quote '#{quote}' under the category #{category}")
|
||||
@ -23,8 +31,25 @@ end
|
||||
|
||||
bot.command :quote do |event, *message|
|
||||
category = message[0]
|
||||
if category == nil
|
||||
event.channel.send_message("You haven't specified a category from where to fetch a random quote!")
|
||||
return
|
||||
end
|
||||
quotes = db.execute("SELECT * FROM quotes WHERE category = ?", [category])
|
||||
event.channel.send_message(quotes.sample[3])
|
||||
quote = quotes.sample
|
||||
event.channel.send_message("##{quote[0]}: #{quote[3]}")
|
||||
nil
|
||||
end
|
||||
|
||||
bot.command :categories do |event, *message|
|
||||
categories = db.execute("SELECT DISTINCT category FROM quotes")
|
||||
event.channel.send_message("**Categories**: #{categories[0..].join(' ')}")
|
||||
nil
|
||||
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.message.delete
|
||||
nil
|
||||
end
|
||||
|
||||
|
BIN
jon.sqlite
BIN
jon.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user