From c55cd01f06f2058b4fd5b28cce90bbbdc37be389 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Tue, 1 Feb 2022 14:15:19 -0700 Subject: [PATCH] cache del util --- commands/dev/eval.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/commands/dev/eval.js b/commands/dev/eval.js index 3960119..c0b5a81 100644 --- a/commands/dev/eval.js +++ b/commands/dev/eval.js @@ -16,6 +16,8 @@ module.exports = { }, execute(message, msg, args, cmd, prefix, mention, client) { try { + const dc = (...files) => {return files.forEach(file => {return delete require.cache[require.resolve(`../../${file}`)];});}; + let timer = new Date().getTime(); if (!client.developers.includes(message.author.id)) {return message.channel.send("Sorry, but I've got trust issues, so only me devs can go commanding me around like that.");}; @@ -27,20 +29,20 @@ module.exports = { if (!args.length) {return message.channel.send("Silly goose, if you want me to do something, you have to tell me what!");} const result = new Promise((resolve) => resolve(eval(args.join(' ')))); return result.then((output) => { - if (typeof output !== 'string') { - output = require('util').inspect(output, {depth: 0}); - } - output = output.replace(client.config.token, 'Client Token') - .replace(client.config.database.password, 'Database Password') - .replace(client.config.database.cluster, 'Database Cluster'); + if (typeof output !== 'string') { + output = require('util').inspect(output, {depth: 0}); + } + output = output.replace(client.config.token, 'Client Token') + .replace(client.config.database.password, 'Database Password') + .replace(client.config.database.cluster, 'Database Cluster'); - return options.silent ? null : message.channel.send({embeds: [new Discord.MessageEmbed() - .setTitle('Client Evaluation') - .setDescription(`\`\`\`js\n${output}\n\`\`\``) - .setColor('c375f0') - .setFooter({text: `Natsuki | Evaluated in ${new Date().getTime() - timer}ms`, iconURL: client.user.avatarURL()}) - .setTimestamp()]}); - }).catch(error => {return message.channel.send(`Error: \`${error}\`.`);}); + return options.silent ? null : message.channel.send({embeds: [new Discord.MessageEmbed() + .setTitle('Client Evaluation') + .setDescription(`\`\`\`js\n${output}\n\`\`\``) + .setColor('c375f0') + .setFooter({text: `Natsuki | Evaluated in ${new Date().getTime() - timer}ms`, iconURL: client.user.avatarURL()}) + .setTimestamp()]}); + }).catch(error => {return message.channel.send(`Error: \`${error}\`.`);}); } catch (error) { let date = new Date; date = date.toString().slice(date.toString().search(":") - 2, date.toString().search(":") + 6); console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | Occurred while trying to run n?eval`)}`, error);