From 99f65f07f5f8830c6e8ea4ae171e986af4d3f1f6 Mon Sep 17 00:00:00 2001 From: Palm Date: Thu, 15 Aug 2024 12:10:04 +0700 Subject: [PATCH] fix(bots/discord): allow access to `context` in `/eval` and await result --- bots/discord/src/commands/admin/eval.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bots/discord/src/commands/admin/eval.ts b/bots/discord/src/commands/admin/eval.ts index 2e716c8..fc67146 100644 --- a/bots/discord/src/commands/admin/eval.ts +++ b/bots/discord/src/commands/admin/eval.ts @@ -19,14 +19,17 @@ export default new AdminCommand({ required: false, }, }, - async execute(_, trigger, { code, 'show-hidden': showHidden }) { + async execute(context, trigger, { code, 'show-hidden': showHidden }) { + // So it doesn't show up as unused, and we can use it in `code` + context + await trigger.reply({ ephemeral: true, embeds: [ createSuccessEmbed('Evaluate', `\`\`\`js\n${code}\`\`\``).addFields({ name: 'Result', // biome-ignore lint/security/noGlobalEval: This is fine as it's an admin command - value: `\`\`\`js\n${inspect(eval(code), { + value: `\`\`\`js\n${inspect(await eval(code), { depth: 1, showHidden, getters: true,