require './lib/race'
require './lib/command/base'

module Command
  class RaceKeys < Base
    MIN_ARGS = 1
    NAME = :racekeys
    USAGE = "#{NAME} sol".freeze
    DESCRIPTION = 'Lists the valid race identifiers that the bot responds to.'.freeze

    def initialize(key_or_keys, event: nil, race_factory: Race)
      super(event)
      @keys = Array(key_or_keys)
      @race_factory = race_factory
    end

    def run
      Race.from(@keys).keys
    rescue Race::NotFoundError => e
      e.message
    end
  end
end
