add aliases

This commit is contained in:
fzorb 2024-10-21 14:20:11 +03:00
parent 40b87f9d5d
commit f6747b03b3
2 changed files with 9 additions and 9 deletions

8
bot.rb
View File

@ -11,10 +11,10 @@ bot.command :help do |event, *message|
**Quote system**
```
;quote <category (optional)> - displays a quote from the category
;addquote <category> <quote> - adds a quote into a category
;quotecategories - shows all categories
;showquote <id> - shows the quote with the id provided```
;quote, ;q <category (optional)> - displays a quote from the category
;quoteadd, ;qa <category> <quote> - adds a quote into a category
;quotecategories ;qc - shows all categories
;quoteshow ;qs <id> - shows the quote with the id provided```
**Networking related commands**
```
;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.

View File

@ -7,7 +7,7 @@ Dotenv.load("#{__dir__}/../.env")
module QuoteSystem
extend Discordrb::Commands::CommandContainer
db = SQLite3::Database.new("jon.sqlite")
command :addquote do |event, *message|
command(:quoteadd, aliases: [:addquote, :qa]) do |event, *message|
if message[0] == nil
event.channel.send_message("You haven't specified a category for your quote.")
return
@ -23,7 +23,7 @@ module QuoteSystem
nil
end
command :quote do |event, *message|
command(:quote, aliases: [:q]) do |event, *message|
category = message[0]
if category == nil
quotes = db.execute("SELECT * FROM quotes")
@ -42,13 +42,13 @@ module QuoteSystem
nil
end
command :quotecategories do |event, *message|
command(:quotecategories, aliases: [:qc]) 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|
command(:showquote, aliases: [:sq, :quoteshow]) do |event, *message|
quote = db.execute("SELECT * FROM quotes WHERE id = ?", [message[0]])
if quote == nil
event.channel.send_message("Quote doesn't exist")
@ -69,4 +69,4 @@ module QuoteSystem
event.channel.send_message("Job complete.")
nil
end
end
end