diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-12-21 17:54:16 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-12-21 17:54:16 -0500 |
| commit | 63682deb929a1a201f4c344f0eaea5ae449b05ac (patch) | |
| tree | 3696db53fd13666c77afdc265ee8191cf1c2568d /deploy-command.js | |
| download | shrimpbot-js-63682deb929a1a201f4c344f0eaea5ae449b05ac.tar.gz shrimpbot-js-63682deb929a1a201f4c344f0eaea5ae449b05ac.tar.bz2 shrimpbot-js-63682deb929a1a201f4c344f0eaea5ae449b05ac.zip | |
Inital commit (aka start of this garbage dump
Diffstat (limited to 'deploy-command.js')
| -rw-r--r-- | deploy-command.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/deploy-command.js b/deploy-command.js new file mode 100644 index 0000000..e6c0f85 --- /dev/null +++ b/deploy-command.js @@ -0,0 +1,18 @@ +import fs, { readFileSync } from 'node:fs'; +import { REST, Routes } from 'discord.js'; +// import config from './config.json' assert {type: 'json'} +const { clientID, token } = JSON.parse(readFileSync('./config.json')); + +const commands = []; +const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); + +for (const file of commandFiles) { + const { default: command } = await import(`./commands/${file}`); + commands.push(command.data.toJSON()); +} + +const rest = new REST({ version: '10' }).setToken(token); + +rest.put(Routes.applicationCommands(clientID), { body: commands }) + .then(() => console.log('Successfully registered application commands.')) + .catch(console.error); |
