From f10e48a8d8d0cdca589c9d73791b9a46e896425d Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Tue, 11 Nov 2025 14:14:48 +0100 Subject: Initial commit --- src/utils/commandRegistry.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/utils/commandRegistry.js (limited to 'src/utils/commandRegistry.js') diff --git a/src/utils/commandRegistry.js b/src/utils/commandRegistry.js new file mode 100644 index 0000000..918e7b3 --- /dev/null +++ b/src/utils/commandRegistry.js @@ -0,0 +1,16 @@ +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 }; -- cgit v1.2.3