From 8187a01b430032d9ad0abc5e59ef501bbf355826 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Wed, 19 Jun 2024 21:49:07 +0100 Subject: [PATCH] feat: eval command --- index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/index.js b/index.js index cc0a375..fe9119f 100644 --- a/index.js +++ b/index.js @@ -184,6 +184,26 @@ app.view("chooseopponent-BEGINNER", async (ctx) => { }) }) +app.command('/bm-eval', async (ctx) => { + await ctx.ack(); + + const resp = require('util').inspect(await eval(ctx.body.text), undefined, 1) + + ctx.respond({ + text: resp, + response_type: 'ephemeral', + blocks: [ + { + type: 'section', + text: { + type: 'mrkdwn', + text: "```" + resp + "```" + } + } + ] + }) +}) + app.command('/viewopponents', async (ctx) => { await ctx.ack();