const { REST, Routes } = require('discord.js'); async function registerCommands(commands, token, clientId) { const rest = new REST({ version: '10' }).setToken(token); try { await rest.put( Routes.applicationCommands(clientId), { body: commands.map(cmd => cmd.toJSON()) } ); } catch (error) { console.error('Error registering commands:', error); } } module.exports = { registerCommands };