From eaa25f2eb58a9e2d25bb98633ad668485e099714 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Mon, 5 Aug 2024 00:42:20 +0700 Subject: [PATCH] fix(bots/discord): make `/eval` work --- bots/discord/src/commands/admin/eval.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bots/discord/src/commands/admin/eval.ts b/bots/discord/src/commands/admin/eval.ts index 93fce79..2e716c8 100644 --- a/bots/discord/src/commands/admin/eval.ts +++ b/bots/discord/src/commands/admin/eval.ts @@ -1,5 +1,4 @@ import { inspect } from 'util' -import { runInThisContext } from 'vm' import { ApplicationCommandOptionType } from 'discord.js' import { AdminCommand } from '$/classes/Command' @@ -26,7 +25,14 @@ export default new AdminCommand({ embeds: [ createSuccessEmbed('Evaluate', `\`\`\`js\n${code}\`\`\``).addFields({ name: 'Result', - value: `\`\`\`js\n${inspect(runInThisContext(code), { depth: 1, showHidden, getters: true, numericSeparator: true, showProxy: true })}\`\`\``, + // biome-ignore lint/security/noGlobalEval: This is fine as it's an admin command + value: `\`\`\`js\n${inspect(eval(code), { + depth: 1, + showHidden, + getters: true, + numericSeparator: true, + showProxy: true, + })}\`\`\``, }), ], })