Jxni
Jxni
DIAdiscord.js - Imagine an app
Created by Jxni on 1/11/2024 in #djs-questions
Discord.js version
Interesting
4 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
No it doesnt work it just says: [11/27/2023, 1:19:03 PM] ✅ Registered 0 commands globally
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
So if I use this code for the Project with multiple subfolders it will work?
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
But I asked how
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
bruh
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
I know
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
but how do I do that all files getting registered in /src/commands/slashCommands/Moderation and /src/commands/slashCommands/Other
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
Where I just have to register files in one folder
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
Ye bc thats the other project
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
I have the same project with just one Slash Command folder. And there the same file (like in the sourcebin link) looks like this:
const { Client, Collection } = require('discord.js');
const fs = require('fs');
const { logger } = require('./src/functions/functions');

module.exports = async (client) => {
client.commands = new Collection();
const commandFiles = fs.readdirSync('./src/commands/slashCommands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
const command = require(`./src/commands/slashCommands/${file}`);
client.commands.set(command.data.name, command);
}

try {
const commands = client.commands.map(command => command.data.toJSON());
const globalCommands = await client.application.commands.set(commands);
console.log(`${logger()} ✅ Registered ${globalCommands.size} commands globally`);
} catch (error) {
console.error(`${logger()} ❌ Error registering slash commands: ${error}`);
}
};
const { Client, Collection } = require('discord.js');
const fs = require('fs');
const { logger } = require('./src/functions/functions');

module.exports = async (client) => {
client.commands = new Collection();
const commandFiles = fs.readdirSync('./src/commands/slashCommands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
const command = require(`./src/commands/slashCommands/${file}`);
client.commands.set(command.data.name, command);
}

try {
const commands = client.commands.map(command => command.data.toJSON());
const globalCommands = await client.application.commands.set(commands);
console.log(`${logger()} ✅ Registered ${globalCommands.size} commands globally`);
} catch (error) {
console.error(`${logger()} ❌ Error registering slash commands: ${error}`);
}
};
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
So what do I do?
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
But the Moderation commands are getting registered tho
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
33 replies
DIAdiscord.js - Imagine an app
Created by Jxni on 11/27/2023 in #djs-questions
Error Loading the src/commands/slashCommands/Other Command files.
Its also fine if u tell me whats wrong
33 replies