From 33718b1162129851f2b200af622b175efbbe299b Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Fri, 10 Feb 2023 20:17:21 -0500 Subject: [PATCH] Updates --- .env | 3 +++ modules/_deploy-commands.js | 39 ------------------------------------- modules/_deploy-global.js | 4 ++-- 3 files changed, 5 insertions(+), 41 deletions(-) create mode 100644 .env delete mode 100644 modules/_deploy-commands.js diff --git a/.env b/.env new file mode 100644 index 0000000..b74db4f --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +TOKEN= +DEBUG=true +CLIENTID= \ No newline at end of file diff --git a/modules/_deploy-commands.js b/modules/_deploy-commands.js deleted file mode 100644 index 933b61f..0000000 --- a/modules/_deploy-commands.js +++ /dev/null @@ -1,39 +0,0 @@ -// dotenv for handling environment variables -const dotenv = require('dotenv'); -dotenv.config(); - -const { REST, Routes } = require('discord.js'); -const { guildId } = require('../data/config.json'); -const clientId = process.env.clientId; -const token = process.env.TOKEN; -const fs = require('fs'); - -const commands = []; -const commandFiles = fs.readdirSync('../slash-commands').filter(file => file.endsWith('.js')); - -for (const file of commandFiles) { - const command = require(`../slash-commands/${file}`); - if (command.data != undefined) { - commands.push(command.data.toJSON()); - } -} - -console.log(commands); - -const rest = new REST({ version: '10' }).setToken(token); - -(async () => { - try { - console.log('Started refreshing application (/) commands.'); - - await rest.put( - Routes.applicationGuildCommands(clientId, guildId), - { body: commands }, - ); - - console.log('Successfully reloaded application (/) commands.'); - process.exit(); - } catch (error) { - console.error(error); - } -})(); \ No newline at end of file diff --git a/modules/_deploy-global.js b/modules/_deploy-global.js index cd7b8ce..d8e703f 100644 --- a/modules/_deploy-global.js +++ b/modules/_deploy-global.js @@ -4,7 +4,7 @@ dotenv.config(); const { REST } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v9'); -const clientId = process.env.clientId; +const clientId = process.env.CLIENTID; const token = process.env.TOKEN; const fs = require('fs'); @@ -18,7 +18,7 @@ for (const file of commandFiles) { } } -console.log(commands); +// console.log(commands); const rest = new REST({ version: '9' }).setToken(token);