mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-23 09:59:42 +02:00
loader add
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
const { Events, InteractionType } = require("discord.js")
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name :Events.InteractionCreate,
|
||||||
|
async run(client, interaction) {
|
||||||
|
|
||||||
|
if(interaction.type === InteractionType.ApplicationCommand) {
|
||||||
|
|
||||||
|
const command = client.commands.get(interaction.commandName);
|
||||||
|
await command.execute(interaction, client);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
const { Events, ActivityType } = require("discord.js")
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
name : Events.ClientReady,
|
||||||
|
async run(client) {
|
||||||
|
|
||||||
|
client.application.commands.set(client.commands.map(command => command.data));
|
||||||
|
console.log(`${client.user.username} est en ligne`);
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
const { readdirSync } = require("fs");
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = async client => {
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
const dirsCommands = readdirSync("./commands/");
|
||||||
|
|
||||||
|
for(const dirs of dirsCommands) {
|
||||||
|
const filesDirs = readdirSync(`./commands/${dirs}/`).filter(f => f.endsWith(".js"));
|
||||||
|
for(const files of filesDirs) {
|
||||||
|
const command = require(`../commands/${dirs}/${files}`);
|
||||||
|
client.commands.set(command.data.name, command);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(`[Commands Slash] => ${count} logged commands`);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
const { readdirSync } = require("fs");
|
||||||
|
|
||||||
|
module.exports = async client => {
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
const dirsEvents = readdirSync("./events/");
|
||||||
|
|
||||||
|
for(const dirs of dirsEvents) {
|
||||||
|
const filesDirs = readdirSync(`./events/${dirs}/`).filter(f => f.endsWith(".js"));
|
||||||
|
for(const files of filesDirs) {
|
||||||
|
const event = require(`../events/${dirs}/${files}`);
|
||||||
|
if(dirs === "music") client.player.events.on(event.name, (...args) => event.run(client, ...args));
|
||||||
|
else client.on(event.name, (...args) => event.run(client, ...args));
|
||||||
|
count++;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(`Event => ${count} chargé sur le bot`)
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = async (client) => {
|
||||||
|
const prefixCommandsPath = path.join(__dirname, '../commandprefix'); // Ajustez le chemin ici
|
||||||
|
const commandFiles = fs.readdirSync(prefixCommandsPath).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
const command = require(`../commandprefix/${file}`); // Ajustez le chemin ici
|
||||||
|
client.prefixCommands.set(command.name, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`[Prefix Commands] => ${client.prefixCommands.size} prefix commands loaded`);
|
||||||
|
};
|
||||||
@@ -7,12 +7,4 @@ client.on('ready', () => {
|
|||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('interactionCreate', async interaction => {
|
|
||||||
if (!interaction.isChatInputCommand()) return;
|
|
||||||
|
|
||||||
if (interaction.commandName === 'ping') {
|
|
||||||
await interaction.reply('Pong!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
client.login(process.env.TOKEN);
|
client.login(process.env.TOKEN);
|
||||||
Reference in New Issue
Block a user