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 system**
``` ```
;quote <category (optional)> - displays a quote from the category ;quote, ;q <category (optional)> - displays a quote from the category
;addquote <category> <quote> - adds a quote into a category ;quoteadd, ;qa <category> <quote> - adds a quote into a category
;quotecategories - shows all categories ;quotecategories ;qc - shows all categories
;showquote <id> - shows the quote with the id provided``` ;quoteshow ;qs <id> - shows the quote with the id provided```
**Networking related commands** **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. ;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 module QuoteSystem
extend Discordrb::Commands::CommandContainer extend Discordrb::Commands::CommandContainer
db = SQLite3::Database.new("jon.sqlite") db = SQLite3::Database.new("jon.sqlite")
command :addquote do |event, *message| command(:quoteadd, aliases: [:addquote, :qa]) do |event, *message|
if message[0] == nil if message[0] == nil
event.channel.send_message("You haven't specified a category for your quote.") event.channel.send_message("You haven't specified a category for your quote.")
return return
@ -23,7 +23,7 @@ module QuoteSystem
nil nil
end end
command :quote do |event, *message| command(:quote, aliases: [:q]) do |event, *message|
category = message[0] category = message[0]
if category == nil if category == nil
quotes = db.execute("SELECT * FROM quotes") quotes = db.execute("SELECT * FROM quotes")
@ -42,13 +42,13 @@ module QuoteSystem
nil nil
end end
command :quotecategories do |event, *message| command(:quotecategories, aliases: [:qc]) do |event, *message|
categories = db.execute("SELECT DISTINCT category FROM quotes") categories = db.execute("SELECT DISTINCT category FROM quotes")
event.channel.send_message("**Categories**: #{categories[0..].join(' ')}") event.channel.send_message("**Categories**: #{categories[0..].join(' ')}")
nil nil
end end
command :showquote do |event, *message| command(:showquote, aliases: [:sq, :quoteshow]) do |event, *message|
quote = db.execute("SELECT * FROM quotes WHERE id = ?", [message[0]]) quote = db.execute("SELECT * FROM quotes WHERE id = ?", [message[0]])
if quote == nil if quote == nil
event.channel.send_message("Quote doesn't exist") event.channel.send_message("Quote doesn't exist")
@ -69,4 +69,4 @@ module QuoteSystem
event.channel.send_message("Job complete.") event.channel.send_message("Job complete.")
nil nil
end end
end end