From 5b4965dcc7285676b2b3b6756c249bd56eaf8485 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Wed, 25 Sep 2024 12:43:42 +0700 Subject: [PATCH] fix(bots/discord): persist changes in context for eval command --- bots/discord/src/commands/admin/eval.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/discord/src/commands/admin/eval.ts b/bots/discord/src/commands/admin/eval.ts index 9a13bcc..3aab45d 100644 --- a/bots/discord/src/commands/admin/eval.ts +++ b/bots/discord/src/commands/admin/eval.ts @@ -1,7 +1,7 @@ import { unlinkSync, writeFileSync } from 'fs' import { join } from 'path' import { inspect } from 'util' -import { runInNewContext } from 'vm' +import { runInContext } from 'vm' import { ApplicationCommandOptionType } from 'discord.js' import { AdminCommand } from '$/classes/Command' @@ -41,7 +41,7 @@ export default new AdminCommand({ // This allows developers to access and modify the context object to apply changes // to the bot while the bot is running, minus malicious actors getting the token to perform malicious actions - const output = await runInNewContext( + const output = await runInContext( code, { ...globalThis,