Fixed deployment settings
This commit is contained in:
10
index.js
10
index.js
@@ -115,11 +115,13 @@ for (const file of commandFiles) {
|
|||||||
client.commands.set(command.data.name, command);
|
client.commands.set(command.data.name, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploy commands
|
|
||||||
deployCommands.deploy(client.guilds.cache.map(guild => guild.id));
|
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
log.DEBUG(`Discord server up and running with client: ${client.user.tag}`);
|
log.DEBUG(`Discord server up and running with client: ${client.user.tag}`);
|
||||||
|
|
||||||
|
// Deploy commands
|
||||||
|
log.DEBUG("Deploying commands");
|
||||||
|
deployCommands.deploy(client.guilds.cache.map(guild => guild.id));
|
||||||
|
|
||||||
log.DEBUG(`Starting HTTP Server`);
|
log.DEBUG(`Starting HTTP Server`);
|
||||||
runHTTPServer();
|
runHTTPServer();
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ client.on(Events.InteractionCreate, async interaction => {
|
|||||||
if (!interaction.isChatInputCommand()) return;
|
if (!interaction.isChatInputCommand()) return;
|
||||||
|
|
||||||
const command = interaction.client.commands.get(interaction.commandName);
|
const command = interaction.client.commands.get(interaction.commandName);
|
||||||
log.DEBUG("Interaction: ", interaction.client.commands);
|
log.DEBUG("Interaction: ", interaction.client);
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
console.error(`No command matching ${interaction.commandName} was found.`);
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ const guildId = process.env.guildId;
|
|||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
|
const { DebugBuilder } = require("./debugBuilder");
|
||||||
|
const log = new DebugBuilder("server", "deployCommands");
|
||||||
|
|
||||||
const commands = [];
|
const commands = [];
|
||||||
// Grab all the command files from the commands directory you created earlier
|
// Grab all the command files from the commands directory you created earlier
|
||||||
const commandsPath = path.resolve('./commands');
|
const commandsPath = path.resolve(__dirname, '../commands');
|
||||||
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
|
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
exports.deploy = (guildIDs) => {
|
exports.deploy = (guildIDs) => {
|
||||||
|
log.DEBUG("Deploying commands for: ", guildIDs);
|
||||||
if (Array.isArray(guildIDs)) guildIDs = [guildIDs];
|
if (Array.isArray(guildIDs)) guildIDs = [guildIDs];
|
||||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
|
|||||||
Reference in New Issue
Block a user