aboutsummaryrefslogtreecommitdiff
path: root/deploy-command.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-09 22:14:38 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-09 22:14:38 -0400
commitd7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc (patch)
treea6fd714025ec7fe78bd89d45d7f0fa36bc8f73aa /deploy-command.js
parent4c26fbcb7e1674d5ccbb5468a32cd4a2bc2a315b (diff)
downloadDLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.tar.gz
DLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.tar.bz2
DLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.zip
ESLint
Diffstat (limited to 'deploy-command.js')
-rw-r--r--deploy-command.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/deploy-command.js b/deploy-command.js
index b3c2d76..f04872e 100644
--- a/deploy-command.js
+++ b/deploy-command.js
@@ -1,18 +1,19 @@
-import fs from 'node:fs'
-import { REST } from '@discordjs/rest'
-import { Routes } from 'discord-api-types/v10'
-import config from './config.json' assert {type: 'json'}
+import fs, { readFileSync } from 'node:fs';
+import { REST } from '@discordjs/rest';
+import { Routes } from 'discord-api-types/v10';
+// import config from './config.json' assert {type: 'json'}
+const config = 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 { default: command } = await import(`./commands/${file}`);
+ commands.push(command.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(config.token);
rest.put(Routes.applicationGuildCommands(config.clientID, config.guildID), { body: commands })
- .then(() => console.log('Successfully registered application commands.'))
- .catch(console.error);
+ .then(() => console.log('Successfully registered application commands.'))
+ .catch(console.error);