// Command registry. Each module exports { data, execute } — `data` is the
// slash-command definition pushed to Discord (registerCommands), `execute` is
// the interactionCreate handler (dispatch). Adding a new command is just
// adding a file here — discordManager.js never needs to change.
const commands = [
  require('./ping.command'),
  require('./modlog.command'),
  require('./ban.command'),
  require('./kick.command'),
  require('./mute.command'),
  require('./warn.command'),
  require('./warnings.command'),
  require('./filter.command'),
  require('./filterallow.command'),
  require('./schedule.command'),
  require('./rolemenu.command'),
  require('./autorole.command'),
  require('./role.command'),
  require('./roles.command'),
  require('./invite.command'),
  require('./news.command'),
  require('./announce.command'),
  require('./wiki.command'),
]

const byName = new Map(commands.map((c) => [c.data.name, c]))

module.exports = {
  all: commands,
  get: (name) => byName.get(name),
}
