summaryrefslogtreecommitdiff
path: root/src/utils/commandRegistry.js
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2025-11-11 14:14:48 +0100
committerYour Name <you@example.com>2025-11-13 19:07:45 +0100
commitf10e48a8d8d0cdca589c9d73791b9a46e896425d (patch)
tree97055c143dffa352cec1a3e122a9061584a1e324 /src/utils/commandRegistry.js
Initial commit
Diffstat (limited to 'src/utils/commandRegistry.js')
-rw-r--r--src/utils/commandRegistry.js16
1 files changed, 16 insertions, 0 deletions
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 };