Main commit

This commit is contained in:
2026-01-05 14:36:22 -03:00
commit ac90a9628d
9 changed files with 283 additions and 0 deletions

20
src/commands/currency.rb Normal file
View File

@@ -0,0 +1,20 @@
module Commands
module Currency
extend self
def register(bot, db)
bot.register_application_command(:currency, 'Get your currency', server_id: ENV['TEST_SERVER_ID'])
bot.application_command(:currency) do |event|
# 1. Get the User ID from the event
user_id = event.user.id
# 2. Ask the DB for the balance
balance = db.get_currency(user_id)
# 3. Respond to Discord
event.respond(content: "You have #{balance} coins.")
end
end
end
end

14
src/commands/echo.rb Normal file
View File

@@ -0,0 +1,14 @@
module Commands
module Echo
extend self
def register(bot, _db)
bot.register_application_command(:echo, 'Repeats what you say', server_id: ENV['TEST_SERVER_ID']) do |cmd|
cmd.string('message', 'The text you want the bot to repeat', required: true)
end
bot.application_command(:echo) do |event|
event.respond(content: "You said: #{event.options['message']}")
end
end
end
end

13
src/commands/ping.rb Normal file
View File

@@ -0,0 +1,13 @@
module Commands
module Ping
extend self
def register(bot, _db)
bot.register_application_command(:ping, 'Check if the bot is alive')
bot.application_command(:ping) do |event|
event.respond(content: 'Pong!')
end
end
end
end