aboutsummaryrefslogtreecommitdiff
path: root/deploy-command.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-26 13:43:03 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-26 13:43:03 -0400
commitd55e74693da3c7b2705d67aa1880baaa0dcd1790 (patch)
tree2588b36a5510adf40295ad1389964e194cb9a742 /deploy-command.js
parent9e2ba5ceb9e7d1e8a4305be36205dde3cfb5b0b9 (diff)
downloadDLAP-d55e74693da3c7b2705d67aa1880baaa0dcd1790.tar.gz
DLAP-d55e74693da3c7b2705d67aa1880baaa0dcd1790.tar.bz2
DLAP-d55e74693da3c7b2705d67aa1880baaa0dcd1790.zip
New interaction handler; Merged git and about
Diffstat (limited to 'deploy-command.js')
-rw-r--r--deploy-command.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/deploy-command.js b/deploy-command.js
new file mode 100644
index 0000000..e11458a
--- /dev/null
+++ b/deploy-command.js
@@ -0,0 +1,18 @@
+const fs = require('node:fs');
+const { REST } = require('@discordjs/rest');
+const { Routes } = require('discord-api-types/v9');
+const config = require('./config.json');
+
+const commands = [];
+const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
+
+for (const file of commandFiles) {
+ const command = require(`./commands/${file}`);
+ commands.push(command.data.toJSON());
+}
+
+const rest = new REST({ version: '9' }).setToken(config.token);
+
+rest.put(Routes.applicationGuildCommands(config.clientID, config.guildID), { body: commands })
+ .then(() => console.log('Successfully registered application commands.'))
+ .catch(console.error);