From afac09a8d1556a99964daa1a43c7f51eeb8f3e97 Mon Sep 17 00:00:00 2001 From: *x1 Date: Sun, 26 May 2024 23:22:27 +0200 Subject: [PATCH] ajout de colors + de client.config.owners (pour bypass les perm) --- config.json | 3 +++ events/messageCreate.js | 8 ++++++-- events/ready.js | 12 ++++++------ main.js | 6 ++++-- 4 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 0000000..ae6d848 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "owners": ["1066067393123733595", "671763971803447298"] +} \ No newline at end of file diff --git a/events/messageCreate.js b/events/messageCreate.js index 292b5bf..9f2ec07 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -15,8 +15,12 @@ module.exports = { const command = client.commands.get(commandName); if (!command) return; - const permissionLevel = 11//await getPermissionLevel(message.member, message.guild); - if (permissionLevel < command.permission) return message.reply("Vous n'avez pas la permission d'utiliser cette commande."); + const permissionLevel = 1 //await getPermissionLevel(message.member, message.guild); + if (permissionLevel < command.permission) { + if (!client.config.owners.includes(message.author.id)) { + return message.reply("Vous n'avez pas la permission d'utiliser cette commande."); + } + } try { command.execute(message, args, client); diff --git a/events/ready.js b/events/ready.js index 7263b31..096e6c5 100644 --- a/events/ready.js +++ b/events/ready.js @@ -4,7 +4,7 @@ const db = require('../fonctions/database.js'); module.exports = { name: Events.ClientReady, async execute(client) { - console.log(`Le bot ${client.user.tag} est en ligne.`); + console.log(`[READY] ${client.user.tag} est prêt ||| ${client.guilds.cache.size.toLocaleString('fr-FR')} serveurs | ${client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0).toLocaleString('fr-FR')} utilisateurs\n`.green); client.user.setPresence({ activities: [{ @@ -40,29 +40,29 @@ module.exports = { //AntiCrash process.on('unhandledRejection', (error) => { - console.log(' [antiCrash] :: Unhandled Rejection/Catch'); + console.log(' [antiCrash] :: Unhandled Rejection/Catch'.red); console.log(error); }); process.on("uncaughtException", (error, origin) => { - console.log(' [antiCrash] :: Uncaught Exception/Catch'); + console.log(' [antiCrash] :: Uncaught Exception/Catch'.red); console.log(error); console.log('Information supplémentaire:', origin); }); process.on('uncaughtExceptionMonitor', (error, origin) => { - console.log(' [antiCrash] :: Uncaught Exception Monitor/Catch'); + console.log(' [antiCrash] :: Uncaught Exception Monitor/Catch'.red); console.log(error); console.log('Information supplémentaire:', origin); }); process.on('beforeExit', (code) => { - console.log(' [antiCrash] :: Before Exit'); + console.log(' [antiCrash] :: Before Exit'.red); console.log('Code de sortie:', code); }); process.on('exit', (code) => { - console.log(' [antiCrash] :: Exit'); + console.log(' [antiCrash] :: Exit'.red); console.log('Code de sortie:', code); }); diff --git a/main.js b/main.js index f5337da..e0047c7 100644 --- a/main.js +++ b/main.js @@ -3,11 +3,13 @@ const { Client, IntentsBitField, Collection } = require("discord.js"); const loadCommands = require("./fonctions/loadCommands"); const loadEvents = require("./fonctions/loadEvents"); const client = new Client({intents: new IntentsBitField(3276799)}); +const color = require('colors') client.events = new Collection(); client.commands = new Collection(); +client.config = require("./config.json"); -console.log(`${loadEvents(client, '..\\events')} events loaded`); -console.log(`${loadCommands(client, '..\\commands')} commands loaded`); +console.log(`${loadEvents(client, '..\\events')} events loaded`.grey); +console.log(`${loadCommands(client, '..\\commands')} commands loaded`.grey); client.login(process.env.TOKEN); \ No newline at end of file