diff --git a/ab-core/events/buttonInteraction.js b/ab-core/events/buttonInteraction.js index 6a32db1..50363b9 100644 --- a/ab-core/events/buttonInteraction.js +++ b/ab-core/events/buttonInteraction.js @@ -1,4 +1,5 @@ const { params } = require("../../config.json"); +const { log } = require("../logger"); module.exports = { name: "interactionCreate", @@ -27,7 +28,7 @@ module.exports = { await command.execute(interaction, params); return; } catch (err) { - console.error(err); + log("ButtonManager", err, "warn", true); await interaction.reply({ content: "[ButtonManager] Il y a eu un problème lors de l'exécution de ce bouton...", ephemeral: true, diff --git a/ab-core/events/contextInteraction.js b/ab-core/events/contextInteraction.js index fe6a79e..4c10853 100644 --- a/ab-core/events/contextInteraction.js +++ b/ab-core/events/contextInteraction.js @@ -1,4 +1,5 @@ const config = require("../../config.json").params; +const { log } = require("../logger"); module.exports = { name: "interactionCreate", @@ -34,7 +35,7 @@ module.exports = { await command.execute(interaction, config); return; } catch (err) { - console.error(err); + log("InteractionManager", err, "warn", true); await interaction.reply({ content: "Il y a eu un problème avec l'exécution de l'interaction...", ephemeral: true, @@ -55,7 +56,7 @@ module.exports = { await command.execute(interaction, config); return; } catch (err) { - console.error(err); + log("InteractionManager", err, "warn", true); await interaction.reply({ content: "Il y a eu un problème avec l'exécution de l'interaction...", ephemeral: true, @@ -64,10 +65,10 @@ module.exports = { } } - // Practically not possible, but we are still caching the bug. + // Practically not possible, but we are still catching the bug. // Possible Fix is a restart! else { - return console.log("[InteractionManager] Quelque chose de suspect est survenue avec le menu. Réception d'un type de menu inconnu."); - } - }, + return log("InteractionManager", "Quelque chose de suspect est survenue avec le menu. Réception d'un type de menu inconnu.", "warn", true); + }; + } }; diff --git a/ab-core/events/guildCreate.js b/ab-core/events/guildCreate.js index 6ad249d..ce6d5fc 100644 --- a/ab-core/events/guildCreate.js +++ b/ab-core/events/guildCreate.js @@ -1,7 +1,9 @@ +const { log } = require("../logger"); + module.exports = { name: "guildCreate", async execute(guild) { - console.log("[Artibot] Ajouté à un nouveau serveur:", guild.name) + log("Artibot", "Ajouté à un nouveau serveur: " + guild.name, "log", true); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/ab-core/events/guildDelete.js b/ab-core/events/guildDelete.js index 83e19ea..7372406 100644 --- a/ab-core/events/guildDelete.js +++ b/ab-core/events/guildDelete.js @@ -1,7 +1,9 @@ +const { log } = require("../logger"); + module.exports = { name: "guildDelete", async execute(guild) { - console.log("[Artibot] Retiré du serveur:", guild.name) + log("Artibot", "Retiré du serveur:" + guild.name, "log", true); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/ab-core/events/initGlobal.js b/ab-core/events/initGlobal.js index 6bcc640..9b4acc9 100644 --- a/ab-core/events/initGlobal.js +++ b/ab-core/events/initGlobal.js @@ -1,20 +1,24 @@ const { params } = require("../../config.json"); -const logPrefix = "[GlobalManager]"; +const { log } = require("../logger"); +const logPrefix = "GlobalManager"; module.exports = { name: "ready", once: true, execute(client) { - console.log(logPrefix, "Initialisation des modules"); + log(logPrefix, "Initialisation des modules...", "info", true); const length = client.global.size; + if (length == 0) { - console.log(logPrefix, "Aucun module à charger."); + log(logPrefix, "Aucun module à charger.", "log", true); return - } - console.log(logPrefix, `Lancement de ${length} module${(length == 1) ? "" : "s"}:`); + }; + + log(logPrefix, `Lancement de ${length} module${(length == 1) ? "" : "s"}:`, "log", true); + client.global.forEach(module => { - console.log(logPrefix, "-", module.name); + log(logPrefix, " - " + module.name, "log", true); setTimeout(() => { module.execute(client, params); }, 1000); diff --git a/ab-core/events/messageCreate.js b/ab-core/events/messageCreate.js index f422cb0..d688984 100644 --- a/ab-core/events/messageCreate.js +++ b/ab-core/events/messageCreate.js @@ -1,5 +1,6 @@ const { Collection, MessageEmbed } = require("discord.js"); const { prefix, ownerId } = require("../../config.json"); +const { log } = require("../logger"); const config = require("../../config.json").params; // Prefix regex, we will use to match in mention prefix. @@ -136,7 +137,7 @@ module.exports = { try { command.execute(message, args, config); } catch (error) { - console.error(error); + log("CommandManager", error, "warn", true); message.reply({ content: "Il y a eu une erreur lors de l'exécution de cette commande.", }); diff --git a/ab-core/events/onReadyMessage.js b/ab-core/events/onReadyMessage.js index 9829ab8..2b2a136 100644 --- a/ab-core/events/onReadyMessage.js +++ b/ab-core/events/onReadyMessage.js @@ -1,8 +1,10 @@ +const { log } = require("../logger"); + module.exports = { name: "ready", once: true, execute(client) { - console.log(`[Artibot] Prêt! Connecté en tant que ${client.user.tag}`); - }, + log("Artibot", `Prêt! Connecté en tant que ${client.user.tag}`, "info", true); + } }; \ No newline at end of file diff --git a/ab-core/events/selectInteraction.js b/ab-core/events/selectInteraction.js index 90492d1..bbbc26e 100644 --- a/ab-core/events/selectInteraction.js +++ b/ab-core/events/selectInteraction.js @@ -1,3 +1,4 @@ +const { log } = require("../logger"); const {params} = require("../../config.json"); module.exports = { @@ -17,8 +18,8 @@ module.exports = { if (!command) { await require("../messages/defaultSelectError").execute(interaction); - return; - } + return + }; // A try to execute the interaction. @@ -26,12 +27,12 @@ module.exports = { await command.execute(interaction, params); return; } catch (err) { - console.error(err); + log("ButtonManager", err, "warn", true); await interaction.reply({ content: "Il y a eu une erreur avec l'exécution de cette option du menu.", ephemeral: true, }); - return; - } - }, + return + }; + } }; diff --git a/ab-core/events/slashCreate.js b/ab-core/events/slashCreate.js index 7f993ff..e35490c 100644 --- a/ab-core/events/slashCreate.js +++ b/ab-core/events/slashCreate.js @@ -1,3 +1,4 @@ +const { log } = require("../logger"); const config = require("../../config.json").params; module.exports = { @@ -22,11 +23,11 @@ module.exports = { try { await command.execute(interaction, config); } catch (err) { - console.error(err); + log("SlashManager", err, "warn", true); await interaction.reply({ content: "Il y a eu une erreur avec l'exécution de cette commande.", - ephemeral: true, + ephemeral: true }); - } - }, + }; + } }; diff --git a/ab-core/events/slashInit.js b/ab-core/events/slashInit.js index 2ba00c1..c4076cb 100644 --- a/ab-core/events/slashInit.js +++ b/ab-core/events/slashInit.js @@ -14,4 +14,4 @@ module.exports = { }; }); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/ab-core/events/triggerCreate.js b/ab-core/events/triggerCreate.js index e16aa9f..20b3346 100644 --- a/ab-core/events/triggerCreate.js +++ b/ab-core/events/triggerCreate.js @@ -1,3 +1,4 @@ +const { log } = require("../logger"); const {params} = require("../../config.json"); module.exports = { @@ -26,16 +27,16 @@ module.exports = { } catch (error) { // If checks fail, reply back! - console.error(error); + log("TriggerManager", error, "warn", true); message.reply({ content: "Il y a eu une erreur avec l'exécution d'un trigger!", }); - } + }; check = 1; - return false; - } + return false + }; }); }); - }, + } }; diff --git a/ab-core/events/updateBotName.js b/ab-core/events/updateBotName.js index 8df6348..d5a7104 100644 --- a/ab-core/events/updateBotName.js +++ b/ab-core/events/updateBotName.js @@ -1,3 +1,5 @@ +const { log } = require("../logger"); + module.exports = { name: "ready", once: true, @@ -6,9 +8,7 @@ module.exports = { const config = require("../../config.json").params; if (client.user.username != config.botName) { client.user.setUsername(config.botName) - .then( - console.log("[Artibot] Nom du bot mis à jour pour", config.botName) - ); - } - }, + .then(log("Artibot", "Nom du bot mis à jour pour " + config.botName, "log", true)); + }; + } }; \ No newline at end of file diff --git a/ab-core/index.js b/ab-core/index.js index 50584f0..bd66c34 100644 --- a/ab-core/index.js +++ b/ab-core/index.js @@ -1,58 +1,61 @@ -const { checkUpdates } = require("./updater"); const slashManager = require("./slashManager"); +const { checkUpdates } = require("./updater"); +const { log } = require("./logger"); try { var fs = require("fs"); var { Client, Collection, Intents } = require("discord.js"); + var chalk = require("chalk"); + var figlet = require("figlet"); } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { - // Re-throw not "Module not found" errors + // Re-throw not "Module not found" errors throw error; } else { - console.error("[Artibot] Erreur de configuration: Les modules Node.js ne sont pas installés correctement."); + log("Artibot", "Erreur de configuration: Les modules Node.js ne sont pas installés correctement.", "err", true); process.exit(1); - } -} + }; +}; + +console.log(chalk.blue(figlet.textSync('Artibot', { + font: 'ANSI Shadow', + horizontalLayout: 'fitted' +}))); -try { var { clientId, testGuildId, disabledModules } = require("../config.json"); } catch (error) { +try { var { clientId, testGuildId, enabledModules } = require("../config.json"); } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { // Re-throw not "Module not found" errors throw error; } else { - console.error("[Artibot] Erreur de configuration: Le fichier config.json est introuvable."); + log("Artibot", "Erreur de configuration: Le fichier config.json est introuvable.", "err", true); process.exit(1); - } -} + }; +}; try { var token = require("../private.json").botToken; } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { // Re-throw not "Module not found" errors throw error; } else { - console.error("[Artibot] Erreur de configuration: Le fichier private.json est introuvable."); + log("Artibot", "Erreur de configuration: Le fichier private.json est introuvable.", "err", true); process.exit(1); - } -} + }; +}; if (!token) { - console.error("[Artibot] Erreur de configuration: Le fichier private.json est invalide."); - process.exit(1); -} - -if (!clientId || !testGuildId || !disabledModules) { - console.error("[Artibot] Erreur de configuration: Le fichier config.json est invalide."); + log("Artibot", "Erreur de configuration: Le fichier private.json est invalide.", "err", true); process.exit(1); -} +}; -if (disabledModules.includes("core")) { - console.error("[Artibot] Erreur de configuration: Le module \"core\" est désactivé dans le fichier de config."); +if (!clientId || !testGuildId || !enabledModules) { + log("Artibot", "Erreur de configuration: Le fichier config.json est invalide.", "err", true); process.exit(1); -} +}; // Depuis Discord.js v13, il est obligatoire de déclarer les intents const client = new Client({ - intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES], + intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES], }); /**********************************************************************/ @@ -72,8 +75,8 @@ for (const file of eventFiles) { event.name, async (...args) => await event.execute(...args, client) ); - } -} + }; +}; /**********************************************************************/ // Définir les collections des commandes, commandes slash et cooldowns @@ -95,14 +98,14 @@ client.global = new Collection(); const globalFolders = fs.readdirSync("./ab-modules/global", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer touts les global dans la collection for (const folder of globalFolders) { const global = require(`../ab-modules/global/${folder}/index.js`); client.global.set(global.name, global); -} +}; /**********************************************************************/ // Initialisation des commandes par message @@ -112,19 +115,25 @@ for (const folder of globalFolders) { const commandFolders = fs.readdirSync("./ab-modules/commands", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer toutes les commandes dans la collection +log("CommandManager", "Activation des commandes:", "info", true); + for (const folder of commandFolders) { + log("CommandManager", " - Activation du module " + folder, "log", true); const commandFiles = fs .readdirSync(`./ab-modules/commands/${folder}`) .filter((file) => file.endsWith(".js")); for (const file of commandFiles) { const command = require(`../ab-modules/commands/${folder}/${file}`); client.commands.set(command.name, command); - } -} + log("CommandManager", " - " + command.name, "log", true); + }; +}; + +if (client.commands.size == 0) log("CommandManager", "Aucun module à charger.", "log", true); /**********************************************************************/ // Initialisation des commandes slash @@ -134,11 +143,14 @@ for (const folder of commandFolders) { const slashCommands = fs.readdirSync("./ab-modules/slash-commands", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer les commandes slash dans la collection +log("SlashManager", "Activation des commandes slash:", "info", true); + for (const module of slashCommands) { + log("SlashManager", " - Activation du module " + module, "log", true); const commandFiles = fs .readdirSync(`./ab-modules/slash-commands/${module}`) .filter((file) => file.endsWith(".js")); @@ -146,8 +158,11 @@ for (const module of slashCommands) { for (const commandFile of commandFiles) { const command = require(`../ab-modules/slash-commands/${module}/${commandFile}`); client.slashCommands.set(command.data.name, command); - } -} + log("SlashManager", " - " + command.data.name, "log", true); + }; +}; + +if (client.slashCommands.size == 0) log("SlashManager", "Aucun module à charger.", "log", true); /**********************************************************************/ // Initialisation du menu sur les messages @@ -155,20 +170,29 @@ for (const module of slashCommands) { const messageMenus = fs.readdirSync("./ab-modules/message-menus", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer le menu des messages dans la collection +log("InteractionManager", "Activation du menu contextuel sur les messages:", "info", true); + for (const folder of messageMenus) { + log("InteractionManager", " - Activation du module " + folder, "log", true); const files = fs .readdirSync(`./ab-modules/message-menus/${folder}`) .filter((file) => file.endsWith(".js")); + for (const file of files) { const menu = require(`../ab-modules/message-menus/${folder}/${file}`); const keyName = `MESSAGE ${menu.data.name}`; client.contextCommands.set(keyName, menu); - } -} + log("InteractionManager", " - " + menu.data.name, "log", true); + }; +}; + +const interactionAmmount = client.contextCommands.size; + +if (interactionAmmount == 0) log("InteractionManager", "Aucun module à charger.", "log", true); /**********************************************************************/ // Initialisation du menu sur les utilisateurs @@ -176,11 +200,14 @@ for (const folder of messageMenus) { const userMenus = fs.readdirSync("./ab-modules/user-menus", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer le menu des utilisateurs dans la collection +log("InteractionManager", "Activation du menu contextuel sur les utilisateurs:", "info", true); + for (const folder of userMenus) { + log("InteractionManager", " - Activation du module " + folder, "log", true); const files = fs .readdirSync(`./ab-modules/user-menus/${folder}`) .filter((file) => file.endsWith(".js")); @@ -188,8 +215,11 @@ for (const folder of userMenus) { const menu = require(`../ab-modules/user-menus/${folder}/${file}`); const keyName = `USER ${menu.data.name}`; client.contextCommands.set(keyName, menu); - } -} + log("InteractionManager", " - " + menu.data.name, "log", true); + }; +}; + +if (interactionAmmount == client.contextCommands.size) log("InteractionManager", "Aucun module à charger.", "log", true); /**********************************************************************/ // Initialisation des bouton @@ -199,11 +229,14 @@ for (const folder of userMenus) { const buttonCommands = fs.readdirSync("./ab-modules/buttons", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); // Enregistrer tous les boutons dans la collection +log("ButtonManager", "Activation des boutons:", "info", true); + for (const module of buttonCommands) { + log("ButtonManager", " - Activation du module " + module, "log", true); const commandFiles = fs .readdirSync(`./ab-modules/buttons/${module}`) .filter((file) => file.endsWith(".js")); @@ -211,37 +244,39 @@ for (const module of buttonCommands) { for (const commandFile of commandFiles) { const command = require(`../ab-modules/buttons/${module}/${commandFile}`); client.buttonCommands.set(command.id, command); - } -} + log("ButtonManager", " - " + command.id, "log", true); + }; +}; + +if (client.buttonCommands.size == 0) log("ButtonManager", "Aucun module à charger.", "log", true); /**********************************************************************/ -// Initialisation des commandes menu select +// Initialisation des menu déroulants -// Toutes les commandes menu select +// Tous les menus déroulants const selectMenus = fs.readdirSync("./ab-modules/select-menus", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); + +// Enregistrer les menus déroulants dans la collection -// Enregistrer les commandes menu select dans la collection +log("ButtonManager", "Activation des menus déroulants:", "info", true); for (const module of selectMenus) { + log("ButtonManager", " - Activation du module " + module, "log", true); const commandFiles = fs .readdirSync(`./ab-modules/select-menus/${module}`) .filter((file) => file.endsWith(".js")); for (const commandFile of commandFiles) { const command = require(`../ab-modules/select-menus/${module}/${commandFile}`); client.selectCommands.set(command.id, command); - } -} - -/**********************************************************************/ -// Initialisation des commandes slash dans l'API Discord + log("ButtonManager", " - " + command.id, "log", true); + }; +}; -slashManager.init(token); -slashManager.generateData(client); -slashManager.register(); +if (client.selectCommands.size == 0) log("ButtonManager", "Aucun module à charger.", "log", true); /**********************************************************************/ // Initialisation des triggers @@ -251,19 +286,25 @@ slashManager.register(); const triggerFolders = fs.readdirSync("./ab-modules/triggers", { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) - .filter(name => !disabledModules.includes(name)); + .filter(name => enabledModules.includes(name) || name == "core"); -// Enregistrer les comamndes dans la collection +// Enregistrer les triggers dans la collection + +log("TriggerManager", "Activation des triggers:", "info", true); for (const folder of triggerFolders) { + log("TriggerManager", " - Activation du module " + folder, "log", true); const triggerFiles = fs .readdirSync(`./ab-modules/triggers/${folder}`) .filter((file) => file.endsWith(".js")); for (const file of triggerFiles) { const trigger = require(`../ab-modules/triggers/${folder}/${file}`); client.triggers.set(trigger.name, trigger); - } -} + log("TriggerManager", " - " + trigger.name, "log", true); + }; +}; + +if (client.triggers.size == 0) log("TriggerManager", "Aucun module à charger.", "log", true); // Connection à l'API Discord avec le bot @@ -272,12 +313,17 @@ client.login(token); // Vérifier si une mise à jour existe sur le repo GitHub checkUpdates().then(response => { if (response.upToDate) { - console.log(`[Updater] Artibot est à jours (v${response.currentVersion})`); + log("Updater", `Artibot est à jour (v${response.currentVersion}).`, "info", true); } else { - console.log( - "[Updater] Une mise à jour est disponible pour Artibot!\n" + - `[Updater] - Version actuelle: ${response.currentVersion}\n` + - `[Updater] - Dernière version: ${response.remoteVersion}` - ); + log("Updater", `Une mise à jour est disponible pour Artibot!`, "warn", true); + log("Updater", ` - Version actuelle: ${response.currentVersion}`, "info", true); + log("Updater", ` - Dernière version: ${response.remoteVersion}`, "info", true); }; -}); \ No newline at end of file +}); + +/**********************************************************************/ +// Initialisation des commandes slash dans l'API Discord + +slashManager.init(token); +slashManager.generateData(client); +slashManager.register(); \ No newline at end of file diff --git a/ab-core/logger.js b/ab-core/logger.js new file mode 100644 index 0000000..6e78646 --- /dev/null +++ b/ab-core/logger.js @@ -0,0 +1,38 @@ +const chalk = require("chalk"); + +module.exports = { + /** + * Log message to console, with proper coloring and prefix. + * + * @author Artivain + * @since v1.5.3 + * @param {string} name Name of the module sending the log. + * @param {string} msg Message to send. + * @param {("log"|"warn"|"err"|"debug"|"info")} type Type of message. + * @param {boolean} isCore Is this message sent from the core? Probably not. + */ + + log(name, msg, type = "log", isCore = false) { + type = type.toLowerCase(); + if (isCore) { + var prefix = chalk.green(`[${name}]`); + } else { + var prefix = chalk.blue(`[${name}]`); + }; + + if (type == "err" || type == "error") { + var content = chalk.red(msg); + } else if (type == "warn" || type == "warning") { + var content = chalk.yellow(msg); + } else if (type == "debug") { + var content = chalk.white(msg); + prefix += chalk.magenta(" (debug)"); + } else if (type == "log") { + var content = chalk.gray(msg); + } else if (type == "info" || type == "infos") { + var content = chalk.cyan(msg); + } else throw `[Logger] log: "${type}" is not a valid type. Valid values are: "log", "warn", "err", "debug", "info".`; + + console.log(prefix, content); + } +}; \ No newline at end of file diff --git a/ab-core/messages/defaultButtonError.js b/ab-core/messages/defaultButtonError.js index 885d6a3..437f6e7 100644 --- a/ab-core/messages/defaultButtonError.js +++ b/ab-core/messages/defaultButtonError.js @@ -1,15 +1,9 @@ module.exports = { - /** - * @description Executes when the button interaction could not be fetched. - * @author Artivain - * @param {Object} interaction The Interaction Object of the command. - */ - async execute(interaction) { await interaction.reply({ content: "Il y a eu une erreur avec ce bouton!", ephemeral: true, }); - return; - }, + return + } }; diff --git a/ab-core/messages/defaultSelectError.js b/ab-core/messages/defaultSelectError.js index 1dd0190..f713c00 100644 --- a/ab-core/messages/defaultSelectError.js +++ b/ab-core/messages/defaultSelectError.js @@ -4,6 +4,6 @@ module.exports = { content: "Il y a eu une erreur avec cette option du menu!", ephemeral: true, }); - return; + return } }; diff --git a/ab-core/messages/onMention.js b/ab-core/messages/onMention.js index b8d2bec..662267b 100644 --- a/ab-core/messages/onMention.js +++ b/ab-core/messages/onMention.js @@ -5,5 +5,5 @@ module.exports = { return message.channel.send( `Bonjour ${message.author}! Mon préfixe est \`${prefix}\`, tu peux obtenir de l'aide en faisait \`${prefix}help\`.` ); - }, + } }; diff --git a/ab-core/slashManager.js b/ab-core/slashManager.js index bd85251..27594f3 100644 --- a/ab-core/slashManager.js +++ b/ab-core/slashManager.js @@ -1,6 +1,7 @@ const { REST } = require("@discordjs/rest"); const { Routes } = require("discord-api-types/v9"); const { clientId, testGuildId, devMode } = require("../config.json"); +const { log } = require("./logger"); var rest = new REST({ version: "9" }); var commandJsonData = []; @@ -19,11 +20,11 @@ module.exports = { async register() { try { - console.log("[SlashManager] Initialisation des commandes slash..."); + log("SlashManager", "Initialisation des commandes slash auprès de Discord...", "info", true); /** - Ici on envoit à Discord les comamndes slash. - Il y a 2 types de comamndes, les "guild" et les "global". + Ici on envoit à Discord les commandes slash. + Il y a 2 types de commandes, les "guild" et les "global". "Guild" pour les commandes par serveur et "global" pour les commandes globales. En développement, utiliser seulement des commandes "guild" puisqu'elles peuvent se rafraichir instantanéments, alors que les commandes globales peuvent prendre jusqu'à 1 heure. @@ -38,13 +39,13 @@ module.exports = { await rest.put( Routes.applicationCommands(clientId), { body: commandJsonData } - ) + ); }; - console.log("[SlashManager] Commandes slash activées avec succès."); + log("SlashManager", "Commandes slash initialisées avec succès.", "log", true); return true } catch (error) { - console.error("[SlashManager] Une erreur est survenue avec l'initialisation des commandes slash, voici les détais:", error); + log("SlashManager", "Une erreur est survenue avec l'initialisation des commandes slash, voici les détais: " + error, "warn", true); return false }; } diff --git a/ab-core/updater.js b/ab-core/updater.js index 92790c3..df696f0 100644 --- a/ab-core/updater.js +++ b/ab-core/updater.js @@ -1,11 +1,12 @@ const AutoGitUpdate = require('auto-git-update'); const { params } = require("../config.json"); +const { log } = require("./logger"); // if ran with npm run updater if (require.main === module) { if (params.checkForUpdates != "stable" && params.checkForUpdates != "unstable") { - console.error("[Updater] Erreur de configuration"); + log("Updater", "Erreur de configuration!", "err", true); process.exit(1); }; @@ -32,8 +33,8 @@ if (require.main === module) { module.exports = { async checkUpdates() { if (params.checkForUpdates != "stable" && params.checkForUpdates != "unstable") { - return console.log("[Updater] Vérification des mises à jours désactivée dans la configuration") - } + return log("Updater", "Vérification des mises à jours désactivée dans la configuration", "err", true) + }; const config = { repository: 'https://github.com/Artivain/artibot', diff --git a/ab-modules/commands/core/help.js b/ab-modules/commands/core/help.js index 177fc65..dec380b 100644 --- a/ab-modules/commands/core/help.js +++ b/ab-modules/commands/core/help.js @@ -1,3 +1,4 @@ +const { log } = require("../../../ab-core/logger"); const { prefix } = require("../../../config.json"); const { MessageEmbed } = require("discord.js"); @@ -45,9 +46,11 @@ module.exports = { .catch((error) => { // On failing, throw error. - console.error( - `Impossible d'envoyer la liste des commandes en MP à ${message.author.tag}.\n`, - error + log( + "Core", + `Impossible d'envoyer la liste des commandes en MP à ${message.author.tag}. Détails de l'erreur: ${error}`, + "warn", + true ); message.reply({ content: "On dirait que c'est impossible pour moi de t'envoyer un message privé!" }); diff --git a/ab-modules/commands/core/reload.js b/ab-modules/commands/core/reload.js index 60261c3..eb39de2 100644 --- a/ab-modules/commands/core/reload.js +++ b/ab-modules/commands/core/reload.js @@ -1,3 +1,4 @@ +const { log } = require("../../../ab-core/logger"); const fs = require("fs"); const { disabledModules } = require("../../../config.json"); @@ -52,14 +53,14 @@ module.exports = { message.channel.send({ content: `La commande \`${newCommand.name}\` a bien été rafraichie!` }); - console.log(`[Artibot] Commande ${newCommand.name} rafraichie.`); + log("CommandManager", `Commande ${newCommand.name} rafraichie.`, "log", true); } catch (error) { // Catch block executes if there is any error in your code. It logs the error in console and also sends back in discord GUI. - console.error(error); + log("CommandManager", error, "warn", true); message.channel.send({ content: `Il y a eu une erreur lors du rechargement de la commadne \`${command.name}\`:\n\`${error.message}\``, }); - } - }, + }; + } }; diff --git a/ab-modules/commands/core/resetslashcmd.js b/ab-modules/commands/core/resetslashcmd.js index 763e0da..093e37e 100644 --- a/ab-modules/commands/core/resetslashcmd.js +++ b/ab-modules/commands/core/resetslashcmd.js @@ -1,3 +1,4 @@ +const { log } = require("../../../ab-core/logger"); const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js'); const { testGuildId } = require("../../../config.json"); @@ -17,7 +18,7 @@ module.exports = { embeds: [waitingEmbed] }); - console.log("[SlashManager] Suppression des commandes slash du bot et du serveur de test en cours..."); + log("SlashManager", "Suppression des commandes slash du bot et du serveur de test en cours...", "log", true); // Fetch test guild message.client.guilds.fetch(testGuildId) @@ -25,12 +26,12 @@ module.exports = { // Remove all commands from test guild guild.commands.set([]) .then(() => { - console.log("[SlashManager] Les commandes ont bien étés supprimées du serveur de test."); + log("SlashManager", "Les commandes ont bien étés supprimées du serveur de test.", "log", true); // Remove all commands from the client (so in all servers) message.client.application.commands.set([]) .then(() => { - console.log("[SlashManager] Les commandes ont bien étés supprimées du bot."); + log("SlashManager", "Les commandes ont bien étés supprimées du bot.", "log", true); const embed = new MessageEmbed() .setColor(config.embedColor) @@ -68,7 +69,7 @@ module.exports = { response.edit({ embeds: [errorEmbed] }); - console.log("[SlashManager] Erreur avec la suppression des commandes slash du bot: " + e); + log("SlashManager", "Erreur avec la suppression des commandes slash du bot: " + e, "warn", true); }); }) .catch(e => { @@ -81,7 +82,7 @@ module.exports = { response.edit({ embeds: [errorEmbed] }); - console.log("[SlashManager] Erreur avec la suppression des commandes dans le serveur de test: " + e); + log("SlashManager", "Erreur avec la suppression des commandes dans le serveur de test: " + e, "warn", true); }); }); } diff --git a/ab-modules/commands/core/update.js b/ab-modules/commands/core/update.js index 6eb0b83..2f581c6 100644 --- a/ab-modules/commands/core/update.js +++ b/ab-modules/commands/core/update.js @@ -1,3 +1,4 @@ +const { log } = require("../../../ab-core/logger"); const updater = require("../../../ab-core/updater"); module.exports = { @@ -34,7 +35,7 @@ module.exports = { if (!response) { message.reply("Une erreur est survenue pendant la mise à jour. Consulter la console pour plus de détails."); return - } + }; message.reply( "Les mises à jour ont bien été installées.\n" + "Le bot va maintenant s'éteindre tout seul.\n" + @@ -45,7 +46,7 @@ module.exports = { }) .catch(e => { message.reply("Une erreur est survenue pendant la mise à jour. Consulter la console pour plus de détails."); - console.error("[Updater] Problème avec la mise à jour: " + e); + log("Updater", "Problème avec la mise à jour: " + e, "warn", true); }); }); } else { @@ -58,8 +59,8 @@ module.exports = { "**Bien lire la documentation avant de faire la mise à jour!**\n" + "Pour faire la mise à jour, faire la commande `update force`." ); - } + }; }); }; - }, + } }; diff --git a/ab-modules/commands/chuckNorris/chuckNorris.js b/ab-modules/commands/meme/chuckNorris.js similarity index 100% rename from ab-modules/commands/chuckNorris/chuckNorris.js rename to ab-modules/commands/meme/chuckNorris.js diff --git a/ab-modules/commands/meme/dadjoke.js b/ab-modules/commands/meme/dadjoke.js new file mode 100644 index 0000000..3308f3b --- /dev/null +++ b/ab-modules/commands/meme/dadjoke.js @@ -0,0 +1,32 @@ +const { MessageEmbed } = require("discord.js"); +const axios = require("axios").default; + +const options = { + url: "https://icanhazdadjoke.com/", + method: "get", + headers: { + "User-Agent": "Artibot (https://github.com/Artivain/artibot)", + "Accept": "application/json" + } +}; + +module.exports = { + name: "dadjoke", + description: "Dit une blague de Chuck Norris.", + + async execute(message, args, config) { + const reponse = await axios(options); + const joke = reponse.data.joke; + + let embed = new MessageEmbed() + .setColor(config.embedColor) + .setTitle("Dad joke") + .setDescription(joke) + .setFooter(config.botName, config.botIcon) + .setTimestamp(); + + await message.reply({ + embeds: [embed] + }); + } +}; \ No newline at end of file diff --git a/ab-modules/global/clocks/index.js b/ab-modules/global/clocks/index.js index de261aa..8432928 100644 --- a/ab-modules/global/clocks/index.js +++ b/ab-modules/global/clocks/index.js @@ -3,9 +3,9 @@ const tz = require('moment-timezone'); const { Client, Intents } = require("discord.js"); function updateActivity(client, config, clock, i) { - const timeNowUpdate = moment().tz(clock.timezone).format(config.module.format); + const timeNowUpdate = moment().tz(clock.timezone).format(config.format); client.user.setActivity(`🕒 ${timeNowUpdate}`); -} +}; function startClock(clock, config, i) { // Since discord.js v13, intents are mandatory @@ -18,43 +18,43 @@ function startClock(clock, config, i) { console.log(`[Clocks] Horloge #${i}: Nom changé pour ${clock.botName}`); }; //set the interval - setInterval(() => updateActivity(client, config, clock, i), config.module.updateinterval); + setInterval(() => updateActivity(client, config, clock, i), config.updateinterval); updateActivity(client, config, clock, i); //tells when it's ready console.log(`[Clocks] Horloge #${i}: Connecté en tant que ${client.user.tag} (${client.user.id}) le ${moment().format("DD MMMM YYYY, HH:mm:ss")}`); }); - client.login(config.module.tokens[i]); -} + client.login(config.tokens[i]); +}; module.exports = { name: "Clocks", - execute(client, config) { - config.module = require("./config.json"); - try { config.module.tokens = require("./private.json"); } catch (error) { + execute() { + config = require("./config.json"); + try { config.tokens = require("./private.json"); } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') { // Re-throw not "Module not found" errors throw error; } else { console.error("[Clocks] Erreur de configuration: Le fichier private.json est introuvable."); process.exit(1); - } - } + }; + }; - if (!config.module.tokens) { + if (!config.tokens) { console.error("[Clocks] Erreur de configuration: Le fichier private.json est invalide."); process.exit(1); - } + }; - if (config.module.tokens.length != config.module.clocks.length) { + if (config.tokens.length != config.clocks.length) { console.error("[Clocks] Erreur de configuration: Le nombre de tokens n'est pas équivalent au nombre d'horloges."); process.exit(1); - } + }; console.log("[Clocks] Chargement..."); - for (var i = 0, len = config.module.clocks.length; i < len; i++) { - startClock(config.module.clocks[i], config, i); - } + for (var i = 0, len = config.clocks.length; i < len; i++) { + startClock(config.clocks[i], config, i); + }; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/ab-modules/global/welcome/config-example.json b/ab-modules/global/welcome/config-example.json new file mode 100644 index 0000000..95da30b --- /dev/null +++ b/ab-modules/global/welcome/config-example.json @@ -0,0 +1,23 @@ +{ + "debug": false, + "servers": { + + "775798875356397608": { + "name": "Super Cool Server", + "welcome": { + "activate": true, + "channel": "926959115404738640", + "showProfilePicture": true, + "showMemberCount": true, + "customInfo": "asdasd" + }, + "farewell": { + "activate": true, + "channel": "926959115404738640", + "showProfilePicture": false, + "showMemberCount": true + } + } + + } +} diff --git a/ab-modules/global/welcome/index.js b/ab-modules/global/welcome/index.js new file mode 100644 index 0000000..9098781 --- /dev/null +++ b/ab-modules/global/welcome/index.js @@ -0,0 +1,100 @@ +/* + * Module Welcome pour Artibot + * Par GoudronViande24 (https://github.com/GoudronViande24) + * Permet d'enoyer des messages de bienvenue et d'au revoir dans un salon dédié. +*/ + +const { debug, servers } = require("./config.json"); +const { MessageEmbed } = require("discord.js"); + +module.exports = { + name: "Welcome", + + async execute(client, config) { + + // Welcome + client.on("guildMemberAdd", async member => { + if (debug) console.log(`[Welcome] (debug) ${member.user.username} vient de rejoindre ${member.guild.name}`); + + // If there is nothing in the config for this server, skip. + if (!(member.guild.id in servers)) { + if (debug) console.log(`[Welcome] (debug) ${member.guild.name} n'est pas dans le fichier de configuration.`); + return + }; + // If welcome is not activated for the server, skip. + if (!servers[member.guild.id].welcome.activate) return; + + let guild = member.guild; + guild.config = servers[member.guild.id]; + const welcomeChannel = await member.guild.channels.fetch(guild.config.welcome.channel); + + // Create content for the embed, based on preferences from the config + let content = `Bienvenue dans le serveur ${guild.config.name? guild.config.name : guild.name}!`; + if (guild.config.welcome.showMemberCount) content += `\nNous sommes maintenant **${guild.memberCount}** membres.`; + + const color = (await member.user.fetch(true)).accentColor || config.embedColor; + + const embed = new MessageEmbed() + .setColor(color) + .setTitle(`${member.user.username} vient de rejoindre le serveur!`) + .setDescription(content) + .setFooter(config.botName, config.botIcon) + .setTimestamp(); + + if (guild.config.welcome.showProfilePicture) { + embed.setThumbnail(`https://cdn.discordapp.com/avatars/${member.user.id}/${member.user.avatar}.webp?size=512`); + }; + + if (guild.config.welcome.customInfo) embed.addField("Informations", guild.config.welcome.customInfo); + + return await welcomeChannel.send({ + embeds: [embed] + }); + + }); + + // Farewell + client.on("guildMemberRemove", async member => { + if (debug) console.log(`[Welcome] (debug) ${member.user.username} vient de quitter ${member.guild.name}`); + + // If there is nothing in the config for this server, skip. + if (!(member.guild.id in servers)) { + if (debug) console.log(`[Welcome] (debug) ${member.guild.name} n'est pas dans le fichier de configuration.`); + return + }; + // If farewell is not activated for the server, skip. + if (!servers[member.guild.id].farewell.activate) return; + + let guild = member.guild; + guild.config = servers[member.guild.id]; + const farewellChannel = await member.guild.channels.fetch(guild.config.farewell.channel); + + // Create content for the embed, based on preferences from the config + let content = "On espère te revoir bientôt!"; + if (guild.config.farewell.showMemberCount) content += `\nNous sommes maintenant **${guild.memberCount}** membres.`; + + const color = (await member.user.fetch(true)).accentColor || config.embedColor; + + const embed = new MessageEmbed() + .setColor(color) + .setTitle(`${member.user.username} vient de quitter le serveur.`) + .setDescription(content) + .setFooter(config.botName, config.botIcon) + .setTimestamp(); + + if (guild.config.farewell.showProfilePicture) { + embed.setThumbnail(`https://cdn.discordapp.com/avatars/${member.user.id}/${member.user.avatar}.webp?size=512`); + }; + + if (guild.config.farewell.customInfo) embed.addField("Informations", guild.config.welcome.customInfo); + + return await farewellChannel.send({ + embeds: [embed] + }); + + }); + + console.log("[Welcome] Prêt."); + + } +}; \ No newline at end of file diff --git a/ab-modules/message-menus/core/react.js b/ab-modules/message-menus/core/react.js index e756974..66c3541 100644 --- a/ab-modules/message-menus/core/react.js +++ b/ab-modules/message-menus/core/react.js @@ -11,6 +11,6 @@ module.exports = { content: "Réaction ajoutée", ephemeral: true }); - return; - }, + return + } }; diff --git a/ab-modules/slash-commands/pokemon/pokedex.js b/ab-modules/slash-commands/pokemon/pokedex.js new file mode 100644 index 0000000..de0e9b5 --- /dev/null +++ b/ab-modules/slash-commands/pokemon/pokedex.js @@ -0,0 +1,151 @@ +/* + * Commande pokedex par GoudronViande24 + * Basé sur le module discord-giveaways par @androz2091 +*/ + +const { MessageEmbed } = require("discord.js"); +const { SlashCommandBuilder } = require("@discordjs/builders"); +const axios = require("axios").default; +const { log } = require("../../../ab-core/logger"); + +const icon = "https://cdn.pixabay.com/photo/2019/11/27/14/06/pokemon-4657023_960_720.png"; +const apiBase = "https://pokeapi.co/api/v2"; + +/** + * Get lenght in feets and inches + * @param {number} n Length in centimeters + * @returns {string} Feets and inches (example: 5'8") + */ + +function toFeet(n) { + var realFeet = ((n * 0.393700) / 12); + var feet = Math.floor(realFeet); + var inches = Math.round((realFeet - feet) * 12); + return `${feet}'${inches}"`; +}; + +/** + * Remove line breaks from a string + * @param {string} str String to remove line breaks + * @returns {string} Same string without line breaks + */ + +function removeLineBreaks(str) { + return str.replace(/(\r\n|\n|\r)/gm, " "); +}; + +module.exports = { + // ######################################## + // Create the command with all the options + // ######################################## + + data: new SlashCommandBuilder() + .setName("pokedex") + .setDescription("Obtenir des informations sur un Pokémon.") + .addStringOption(option => + option + .setName("id") + .setDescription("Le ID (ou le nom en anglais) du Pokémon à chercher.") + .setRequired(true) + ), + + async execute(interaction, config) { + // Send "Loading" embed + let waitEmbed = new MessageEmbed() + .setColor("#e3350d") + .setTitle("Pokédex") + .setImage(icon) + .setTimestamp() + .setFooter(config.botName, config.botIcon) + .setDescription("Recherche en cours..."); + + const message = await interaction.reply({ + embeds: [waitEmbed], + fetchReply: true + }); + + const input = interaction.options.getString("id").toLowerCase(); + + try { + var response = await axios.get(apiBase + "/pokemon-species/" + input); + var response2 = await axios.get(apiBase + "/pokemon/" + input); + } catch (error) { + if (error.response.status == 404) { + var content = `**Erreur:**\nImpossible de trouver le Pokémon avec le ID ou le nom \`${input}\`.`; + } else { + var content = `Une erreur est survenue.`; + }; + + let errorEmbed = new MessageEmbed() + .setColor("#e3350d") + .setTitle("Pokédex") + .setTimestamp() + .setFooter(config.botName, config.botIcon) + .setDescription(content); + + await message.edit({ + embeds: [errorEmbed] + }); + + return + }; + + const data = response.data; + const data2 = response2.data; + + let types = ""; + data2.types.forEach(i => types += i.type.name + "\n"); + types = types.trim(); + + let forms = ""; + data2.forms.forEach(form => forms += form.name + "\n"); + forms = forms.trim(); + + let abilities = ""; + data2.abilities.forEach(i => abilities += i.ability.name + "\n"); + abilities = abilities.trim(); + + let special = ""; + if (data.is_legendary) special += "Pokémon légendaire\n"; + if (data.is_mythical) special += "Pokémon mythique\n"; + special = special.trim(); + + const flavorText = removeLineBreaks(data.flavor_text_entries.find(i => i.language.name == "fr").flavor_text); + const name = data.names.find(i => i.language.name == "fr").name; + const id = data.id; + const generation = data.generation.name.split("-")[1].toUpperCase(); + const category = data.genera.find(i => i.language.name == "fr").genus; + const image = data2.sprites.other["official-artwork"].front_default; + const height = `${data2.height * 10} cm\n${toFeet(data2.height * 10)}`; + const weight = `${data2.weight / 10} kg\n${Math.round(data2.weight / 10 * 2.205 * 10) / 10} lb`; + + let embed = new MessageEmbed() + .setColor("#e3350d") + .setTitle("Pokédex") + .setTimestamp() + .setFooter(config.botName, config.botIcon) + .setDescription(`**${name}** - #${id}\n${category}\n${flavorText}`) + .setImage(image) + .addField("Type(s)", types, true) + .addField("Grandeur", height, true) + .addField("Poid", weight, true) + .addField("Génération", generation, true) + .addField("Formes", forms, true) + .addField("Capacité(s)", abilities, true); + + if (special) { + embed.addField("Attribut spécial", special, true); + }; + + if (data.evolves_from_species) { + const response3 = await axios.get(data.evolves_from_species.url); + const data3 = response3.data; + const evolvesFromName = data3.names.find(i => i.language.name == "fr").name; + embed.addField("Est l'évolution de", evolvesFromName, true); + }; + + await message.edit({ + embeds: [embed] + }); + } +}; diff --git a/ab-modules/triggers/core/69.js b/ab-modules/triggers/meme/69.js similarity index 100% rename from ab-modules/triggers/core/69.js rename to ab-modules/triggers/meme/69.js diff --git a/ab-modules/triggers/core/sus.js b/ab-modules/triggers/meme/sus.js similarity index 100% rename from ab-modules/triggers/core/sus.js rename to ab-modules/triggers/meme/sus.js diff --git a/config-example.json b/config-example.json index 86ff21d..13598eb 100644 --- a/config-example.json +++ b/config-example.json @@ -4,7 +4,7 @@ "clientId": "826609045569929247", "testGuildId": "775798875356397608", "devMode": true, - "disabledModules": ["twitch", "clocks", "reactionRole", "vcRole", "crypto", "documentation"], + "enabledModules": ["giveaways", "moderation", "whois", "meme", "pokemon"], "params": { "embedColor": "#06476d", "botName": "Artibot [dev]", diff --git a/package-lock.json b/package-lock.json index 53519a4..c703d37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,24 @@ { "name": "artibot", - "version": "1.5.0", + "version": "1.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "artibot", - "version": "1.5.0", + "version": "1.6.0", "license": "GPL-3.0-or-later", "dependencies": { "@discordjs/builders": "^0.8.2", "@discordjs/rest": "^0.1.0-canary.0", "auto-git-update": "^2.0.2", "axios": "^0.24.0", + "chalk": "^4.1.2", "discord-api-types": "^0.25.2", "discord-giveaways": "^5.0.1", "discord.js": "^13.4.0", "discordjs-reaction-role": "^2.1.0", + "figlet": "^1.5.2", "humanize-duration": "^3.27.1", "moment": "^2.29.1", "moment-timezone": "^0.5.31", @@ -399,7 +401,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -415,7 +416,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -424,7 +424,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -774,6 +773,14 @@ "node": ">=6" } }, + "node_modules/figlet": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.5.2.tgz", + "integrity": "sha512-WOn21V8AhyE1QqVfPIVxe3tupJacq1xGkPTB4iagT6o+P2cAgEOOwIxMftr4+ZCTI6d551ij9j61DFr0nsP2uQ==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2392,7 +2399,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -2401,14 +2407,12 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -2685,6 +2689,11 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, + "figlet": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.5.2.tgz", + "integrity": "sha512-WOn21V8AhyE1QqVfPIVxe3tupJacq1xGkPTB4iagT6o+P2cAgEOOwIxMftr4+ZCTI6d551ij9j61DFr0nsP2uQ==" + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", diff --git a/package.json b/package.json index d9510ec..b8904f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "artibot", - "version": "1.5.0", + "version": "1.6.0", "description": "Bot open-source fait par Artivain et les contributeurs. ", "main": "index.js", "scripts": { @@ -25,10 +25,12 @@ "@discordjs/rest": "^0.1.0-canary.0", "auto-git-update": "^2.0.2", "axios": "^0.24.0", + "chalk": "^4.1.2", "discord-api-types": "^0.25.2", "discord-giveaways": "^5.0.1", "discord.js": "^13.4.0", "discordjs-reaction-role": "^2.1.0", + "figlet": "^1.5.2", "humanize-duration": "^3.27.1", "moment": "^2.29.1", "moment-timezone": "^0.5.31",