Remove unused code, clean up folder tree

This commit is contained in:
spiral 2021-07-16 21:10:49 -04:00
parent a4892d854b
commit 1e8c1261f5
No known key found for this signature in database
GPG key ID: A6059F0CA0E1BD31
14 changed files with 38 additions and 80 deletions

49
command/eval.js Normal file
View file

@ -0,0 +1,49 @@
const Discord = require('discord.js');
const Logger = require('@lilywonhalf/pretty-logger');
const Config = require('../config.json');
const CommandCategory = require('../model/command-category');
const CommandPermission = require('../model/command-permission');
// Including every model here so that it's ready to be used by the command
const Guild = require('../model/guild');
const JAVASCRIPT_LOGO_URL = 'https://i.discord.fr/IEV8.png';
class Eval
{
constructor() {
this.aliases = [];
this.category = CommandCategory.BOT_MANAGEMENT;
this.isAllowedForContext = CommandPermission.isMommy;
}
/**
* @param {Message} message
*/
async process(message) {
const code = message.content
.substr(Config.prefix.length + 'eval'.length)
.trim()
.replace(/(`{3})js\n(.+)\n\1/iu, '$2')
.trim();
await message.react('✔');
Logger.notice('Eval: ' + code);
let output = null;
try {
output = eval(`${code}`); // Spoopy! 🎃 🦇 👻 ☠ 🕷
} catch (exception) {
output = `**${exception.name}: ${exception.message}**\n${exception.stack}`;
}
const embed = new Discord.MessageEmbed()
.setAuthor('Eval', JAVASCRIPT_LOGO_URL)
.setColor(0x00FF00)
.setDescription(output);
message.channel.send(embed).catch(error => Logger.warning(error.toString()));
}
}
module.exports = new Eval();