mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bots/discord): allow access to context in /eval and await result
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user