Skip to content

Commit

Permalink
fix(bots/discord): make /eval work
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Aug 4, 2024
1 parent a976dd2 commit eaa25f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bots/discord/src/commands/admin/eval.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { inspect } from 'util'
import { runInThisContext } from 'vm'
import { ApplicationCommandOptionType } from 'discord.js'

import { AdminCommand } from '$/classes/Command'
Expand All @@ -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,
})}\`\`\``,
}),
],
})
Expand Down

0 comments on commit eaa25f2

Please sign in to comment.