diff options
author | Minteck <contact@minteck.org> | 2022-01-09 18:22:55 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-01-09 18:22:55 +0100 |
commit | 7d0d6272c8bf5260da53210c8ed327980e396397 (patch) | |
tree | 6812176231961767e9b7aa731193abb387bbc107 /commands/eval.js | |
parent | dc65563df84d80bcc0970febef6a5f9a7759bdcb (diff) | |
download | ponyfind-7d0d6272c8bf5260da53210c8ed327980e396397.tar.gz ponyfind-7d0d6272c8bf5260da53210c8ed327980e396397.tar.bz2 ponyfind-7d0d6272c8bf5260da53210c8ed327980e396397.zip |
Update
Diffstat (limited to 'commands/eval.js')
-rw-r--r-- | commands/eval.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/commands/eval.js b/commands/eval.js new file mode 100644 index 0000000..49c8162 --- /dev/null +++ b/commands/eval.js @@ -0,0 +1,49 @@ +const fs = require('fs'); +const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js'); + +const admin = fs.readFileSync("./config/admin.txt").toString().trim(); +const list = Object.keys(JSON.parse(fs.readFileSync("./data/data.json").toString())); + +const getResult = require('../modules/result'); +const getEmbed = require('../modules/embed'); +const getPixel = require("../modules/pixel"); + +const official = fs.readFileSync("./config/official.txt").toString().replace(/\r\n/g, "\n").split("\n"); +const fpserver = fs.readFileSync("./config/fpserver.txt").toString().trim(); + +module.exports = async (interaction) => { + if (interaction.user.id !== admin) { + await interaction.reply({ + ephemeral: interaction.guild !== null, + embeds: [ + new MessageEmbed() + .setColor('#dc2828') + .setTitle(l("Permission denied", "Accès refusé", interaction.user.id, 0)) + .setDescription(l("You don't have sufficient permission to run this command. You need to be a bot administrator, or have the **Manage Server** permission.", "Vous ne disposez pas de permissions suffisantes pour exécuter cette commande. Vous devez être administrateur(ice) de robot, ou avoir la permission **Gérer le serveur**.", interaction.user.id, 0)) + ] + }); + return; + } + + try { + await interaction.reply({ + ephemeral: interaction.guild !== null, + embeds: [ + new MessageEmbed() + .setColor('#28dc46') + .setTitle("JavaScript") + .setDescription("```\n" + await eval(interaction.options.getString("code")).toString().replace(/`/g, "\\`") + "\n```") + ] + }); + } catch (e) { + await interaction.reply({ + ephemeral: interaction.guild !== null, + embeds: [ + new MessageEmbed() + .setColor('#dc2828') + .setTitle("JavaScript") + .setDescription("```\n" + e.stack + "\n```") + ] + }); + } +}
\ No newline at end of file |