From 876c3daa7fea592242136d4190a70975443914e8 Mon Sep 17 00:00:00 2001 From: Luis Bauza Date: Sun, 9 Feb 2025 14:58:31 -0500 Subject: [PATCH] Refactor codebase to use ES modules, add logger utility, and update package dependencies --- bot.js | 15 +- commands/ask.js | 6 +- commands/help.js | 8 +- commands/kick.js | 28 ++-- commands/ping.js | 8 +- commands/prune.js | 4 +- deploy-commands.js | 53 ++++--- logger.js | 29 ++++ package-lock.json | 388 +++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 + 10 files changed, 471 insertions(+), 70 deletions(-) create mode 100644 logger.js diff --git a/bot.js b/bot.js index e3aacd1..c8d0ea0 100644 --- a/bot.js +++ b/bot.js @@ -10,6 +10,9 @@ require('dotenv').config(); const fs = require('node:fs'); const path = require('node:path'); const { Client, Collection, Events, GatewayIntentBits } = require('discord.js'); +const Logger = require('./logger'); + +const logger = new Logger('bot'); const client = new Client({ intents: [ @@ -23,16 +26,14 @@ client.commands = new Collection(); const commandsPath = path.join(__dirname, 'commands'); const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); -const logger = message => process.stdout.write(`${message}\n`); - await Promise.all( commandFiles.map(async file => { const filePath = path.join(commandsPath, file); - const command = await import(`file://${filePath}`); + const command = await import(filePath); if ('data' in command && 'execute' in command) { client.commands.set(command.data.name, command); } else { - logger( + logger.warn( `[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`, ); } @@ -40,7 +41,7 @@ await Promise.all( ); client.once(Events.ClientReady, () => { - console.log(`Ready! Logged in as ${client.user.tag}`); + logger.log(`Ready! Logged in as ${client.user.tag}`); }); client.on(Events.InteractionCreate, async interaction => { @@ -49,14 +50,14 @@ client.on(Events.InteractionCreate, async interaction => { const command = client.commands.get(interaction.commandName); if (!command) { - console.error(`No command matching ${interaction.commandName} was found.`); + logger.error(`No command matching ${interaction.commandName} was found.`); return; } try { await command.execute(interaction); } catch (error) { - console.error(error); + logger.error(error); if (interaction.replied || interaction.deferred) { await interaction.followUp({ content: 'There was an error while executing this command!', diff --git a/commands/ask.js b/commands/ask.js index 5ab8b83..66ddac9 100644 --- a/commands/ask.js +++ b/commands/ask.js @@ -6,8 +6,8 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { SlashCommandBuilder } = require('discord.js'); -const axios = require('axios'); +import { SlashCommandBuilder } from 'discord.js'; +import axios from 'axios'; const config = { webSearch: { @@ -16,7 +16,7 @@ const config = { }, }; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('ask') .setDescription('Ask a question to the AI') diff --git a/commands/help.js b/commands/help.js index bbcdeee..b3adcb1 100644 --- a/commands/help.js +++ b/commands/help.js @@ -6,12 +6,10 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { SlashCommandBuilder, EmbedBuilder } = require('discord.js'); +import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; -module.exports = { - data: new SlashCommandBuilder() - .setName('help') - .setDescription('Lists all available commands'), +export default { + data: new SlashCommandBuilder().setName('help').setDescription('Lists all available commands'), async execute(interaction) { const { commands } = interaction.client; const helpEmbed = new EmbedBuilder() diff --git a/commands/kick.js b/commands/kick.js index 1e4e28f..b069ba2 100644 --- a/commands/kick.js +++ b/commands/kick.js @@ -6,26 +6,23 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; -module.exports = { +// eslint-disable-next-line import/extensions +import logger from '../logger.js'; + +export default { data: new SlashCommandBuilder() .setName('kick') .setDescription('Kick a user from the server') .addUserOption(option => - option - .setName('target') - .setDescription('The user to kick') - .setRequired(true), - ) - .addStringOption(option => - option.setName('reason').setDescription('Reason for kicking'), + option.setName('target').setDescription('The user to kick').setRequired(true), ) + .addStringOption(option => option.setName('reason').setDescription('Reason for kicking')) .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers), async execute(interaction) { const target = interaction.options.getMember('target'); - const reason = - interaction.options.getString('reason') ?? 'No reason provided'; + const reason = interaction.options.getString('reason') ?? 'No reason provided'; if (!target) { return interaction.reply({ @@ -36,21 +33,20 @@ module.exports = { if (!target.kickable) { return interaction.reply({ - content: - 'I cannot kick this user! They may have higher permissions than me.', + content: 'I cannot kick this user! They may have higher permissions than me.', ephemeral: true, }); } try { await target.kick(reason); - await interaction.reply({ + return await interaction.reply({ content: `Successfully kicked ${target.user.tag}\nReason: ${reason}`, ephemeral: true, }); } catch (error) { - console.error(error); - await interaction.reply({ + logger.error(error); + return interaction.reply({ content: 'There was an error trying to kick this user!', ephemeral: true, }); diff --git a/commands/ping.js b/commands/ping.js index 7256e7e..9208bb5 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -6,12 +6,10 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { SlashCommandBuilder } = require('discord.js'); +import { SlashCommandBuilder } from 'discord.js'; -module.exports = { - data: new SlashCommandBuilder() - .setName('ping') - .setDescription('Replies with Pong!'), +export default { + data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'), async execute(interaction) { await interaction.reply('Pong! 🏓'); }, diff --git a/commands/prune.js b/commands/prune.js index a2cca43..f69ec5b 100644 --- a/commands/prune.js +++ b/commands/prune.js @@ -6,9 +6,9 @@ // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js'); +import { SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('prune') .setDescription('Prune up to 99 messages.') diff --git a/deploy-commands.js b/deploy-commands.js index fca7710..33078de 100644 --- a/deploy-commands.js +++ b/deploy-commands.js @@ -1,4 +1,3 @@ -require('dotenv').config(); // deploy-commands.js - Discord bot command deployment // Copyright (C) 2025 Luis Bauza // @@ -7,37 +6,45 @@ require('dotenv').config(); // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -const { REST, Routes } = require('discord.js'); -const fs = require('node:fs'); -const path = require('node:path'); +import dotenv from 'dotenv'; +import { REST, Routes } from 'discord.js'; +import { readdirSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +// eslint-disable-next-line import/extensions +import Logger from './logger.js'; + +dotenv.config(); + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const logger = new Logger('deploy-commands'); const commands = []; -const commandsPath = path.join(__dirname, 'commands'); -const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); +const commandsPath = join(__dirname, 'commands'); +const commandFiles = readdirSync(commandsPath).filter(file => file.endsWith('.js')); -for (const file of commandFiles) { - const filePath = path.join(commandsPath, file); - const command = require(filePath); +await Promise.all( + commandFiles.map(async file => { + const filePath = join(commandsPath, file); + const command = await import(filePath); if ('data' in command && 'execute' in command) { - commands.push(command.data.toJSON()); - } else { - console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); + commands.push(command.data.toJSON()); } -} + }), +); const rest = new REST().setToken(process.env.DISCORD_TOKEN); (async () => { - try { - console.log(`Started refreshing ${commands.length} application (/) commands.`); + try { + logger.log(`Started refreshing ${commands.length} application (/) commands.`); - const data = await rest.put( - Routes.applicationCommands(process.env.CLIENT_ID), - { body: commands }, - ); + const data = await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), { + body: commands, + }); - console.log(`Successfully reloaded ${data.length} application (/) commands.`); - } catch (error) { - console.error(error); - } + logger.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + logger.error(error); + } })(); diff --git a/logger.js b/logger.js new file mode 100644 index 0000000..7d2468b --- /dev/null +++ b/logger.js @@ -0,0 +1,29 @@ +import chalk from 'chalk'; + +class Logger { + constructor(moduleName) { + this.moduleName = moduleName; + } + + log(message) { + console.log(`${chalk.blue('📝')} ${chalk.blue(`[${this.moduleName}]`)} ${message}`); + } + + error(message) { + console.error(`${chalk.red('❌')} ${chalk.red(`[${this.moduleName}]`)} ${message}`); + } + + warn(message) { + console.warn(`${chalk.yellow('âš ī¸')} ${chalk.yellow(`[${this.moduleName}]`)} ${message}`); + } + + info(message) { + console.info(`${chalk.green('â„šī¸')} ${chalk.green(`[${this.moduleName}]`)} ${message}`); + } + + debug(message) { + console.debug(`${chalk.gray('🔧')} ${chalk.gray(`[${this.moduleName}]`)} ${message}`); + } +} + +export default Logger; diff --git a/package-lock.json b/package-lock.json index 3fbb70b..3c7619a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "GPL-3.0", "dependencies": { "axios": "^1.7.9", + "chalk": "^5.4.1", "discord.js": "^14.17.3", "dotenv": "^16.3.1" }, @@ -2090,6 +2091,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/console/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jest/core": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", @@ -2138,6 +2156,23 @@ } } }, + "node_modules/@jest/core/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jest/environment": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", @@ -2259,6 +2294,23 @@ } } }, + "node_modules/@jest/reporters/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", @@ -2376,6 +2428,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/transform/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jest/types": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", @@ -2394,6 +2463,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/types/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", @@ -3014,6 +3100,23 @@ "@babel/core": "^7.8.0" } }, + "node_modules/babel-jest/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -3306,17 +3409,12 @@ "license": "CC-BY-4.0" }, "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { - "node": ">=10" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" @@ -3477,6 +3575,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/create-jest/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -4198,6 +4313,23 @@ "dev": true, "license": "Python-2.0" }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -5640,6 +5772,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-circus/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-cli": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", @@ -5674,6 +5823,23 @@ } } }, + "node_modules/jest-cli/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-config": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", @@ -5720,6 +5886,23 @@ } } }, + "node_modules/jest-config/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-diff": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", @@ -5736,6 +5919,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-docblock": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", @@ -5766,6 +5966,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-each/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-environment-node": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", @@ -5850,6 +6067,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-matcher-utils/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-message-util": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", @@ -5871,6 +6105,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-message-util/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-mock": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", @@ -5949,6 +6200,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-resolve/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-runner": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", @@ -5982,6 +6250,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-runner/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-runtime": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", @@ -6016,6 +6301,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-runtime/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-snapshot": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", @@ -6048,6 +6350,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-snapshot/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-snapshot/node_modules/semver": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.0.tgz", @@ -6079,6 +6398,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-util/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-validate": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", @@ -6110,6 +6446,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/jest-validate/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-watcher": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", @@ -6130,6 +6483,23 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-watcher/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/jest-worker": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", diff --git a/package.json b/package.json index 3f2f687..9f194cc 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "A simple Discord bot", "main": "bot.js", + "type": "module", "scripts": { "start": "node bot.js", "deploy": "node deploy-commands.js", @@ -15,6 +16,7 @@ "license": "GPL-3.0", "dependencies": { "axios": "^1.7.9", + "chalk": "^5.4.1", "discord.js": "^14.17.3", "dotenv": "^16.3.1" },