From 8ed0b969dde42390430c823e3f83b34955149774 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Sat, 11 Mar 2023 21:22:33 -0500 Subject: [PATCH] Fix bug in deploy commands - Pass the client ID from the bot to the command --- index.js | 4 ++-- utilities/deployCommands.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index a99a8f2..9c787d3 100644 --- a/index.js +++ b/index.js @@ -123,7 +123,7 @@ client.on('ready', () => { // Deploy slash commands log.DEBUG("Deploying slash commands"); - deployCommands.deploy(client.guilds.cache.map(guild => guild.id)); + deployCommands.deploy(client.user.id, client.guilds.cache.map(guild => guild.id)); log.DEBUG(`Starting HTTP Server`); runHTTPServer(); @@ -146,4 +146,4 @@ for (const file of eventFiles) { } } -client.login(discordToken); //Load Client Discord Token \ No newline at end of file +client.login(discordToken); //Load Client Discord Token diff --git a/utilities/deployCommands.js b/utilities/deployCommands.js index e64df84..d05a110 100644 --- a/utilities/deployCommands.js +++ b/utilities/deployCommands.js @@ -2,8 +2,8 @@ const { REST, Routes } = require('discord.js'); require('dotenv').config(); const token = process.env.TOKEN; -const clientId = process.env.clientId; -const guildId = process.env.guildId; +//const clientId = process.env.clientId; +//const guildId = process.env.guildId; const fs = require('node:fs'); const path = require('node:path'); @@ -16,7 +16,7 @@ const commands = []; const commandsPath = path.resolve(__dirname, '../commands'); const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); -exports.deploy = (guildIDs) => { +exports.deploy = (clientId, guildIDs) => { log.DEBUG("Deploying commands for: ", guildIDs); if (Array.isArray(guildIDs)) guildIDs = [guildIDs]; // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment @@ -46,4 +46,4 @@ exports.deploy = (guildIDs) => { } })() } -}; \ No newline at end of file +};