fix(bots/discord): allow access to context in /eval and await result

This commit is contained in:
Palm
2024-08-15 12:10:04 +07:00
committed by GitHub
parent 51f877f321
commit 99f65f07f5

View File

@@ -19,14 +19,17 @@ export default new AdminCommand({
required: false, 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({ await trigger.reply({
ephemeral: true, ephemeral: true,
embeds: [ embeds: [
createSuccessEmbed('Evaluate', `\`\`\`js\n${code}\`\`\``).addFields({ createSuccessEmbed('Evaluate', `\`\`\`js\n${code}\`\`\``).addFields({
name: 'Result', name: 'Result',
// biome-ignore lint/security/noGlobalEval: This is fine as it's an admin command // 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, depth: 1,
showHidden, showHidden,
getters: true, getters: true,