mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-23 01:49:29 +02:00
blablabla du kaka
This commit is contained in:
@@ -4,7 +4,11 @@ module.exports = {
|
|||||||
name : Events.ClientReady,
|
name : Events.ClientReady,
|
||||||
async run(client) {
|
async run(client) {
|
||||||
|
|
||||||
client.application.commands.set(client.commands.map(command => command.data));
|
if (client.commands && Array.isArray(client.commands)) {
|
||||||
|
client.application.commands.set(client.commands.map(command => command.data));
|
||||||
|
} else {
|
||||||
|
console.error('Les commandes du client sont manquantes ou mal formatées');
|
||||||
|
}
|
||||||
console.log(`${client.user.username} est en ligne`);
|
console.log(`${client.user.username} est en ligne`);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
const { readdirSync } = require("fs");
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = (client) => {
|
module.exports = (client) => {
|
||||||
const loadCommands = (dir) => {
|
const loadCommands = (dir) => {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module.exports = (client) => {
|
|||||||
} else if (file.endsWith('.js')) {
|
} else if (file.endsWith('.js')) {
|
||||||
delete require.cache[require.resolve(filePath)];
|
delete require.cache[require.resolve(filePath)];
|
||||||
const event = require(filePath);
|
const event = require(filePath);
|
||||||
client.on(event.name, (...args) => event.execute(...args, client));
|
client.on(event.name, (...args) => event.run(...args, client));
|
||||||
console.log(`Event ${event.name} loaded`);
|
console.log(`Event ${event.name} loaded`);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const { Client, IntentsBitField, Collection } = require("discord.js");
|
const { Client, IntentsBitField, Collection } = require("discord.js");
|
||||||
|
const loadCommands = require("./loaders/loadCommands")
|
||||||
|
const loadEvents = require("./loaders/loadEvents");
|
||||||
const client = new Client({intents: new IntentsBitField(3276799)});
|
const client = new Client({intents: new IntentsBitField(3276799)});
|
||||||
|
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
});
|
});
|
||||||
|
(async () => {
|
||||||
|
await loadCommands(client);
|
||||||
|
await loadEvents(client);
|
||||||
|
await client.login(process.env.TOKEN);
|
||||||
|
})();
|
||||||
client.login(process.env.TOKEN);
|
client.login(process.env.TOKEN);
|
||||||
Reference in New Issue
Block a user