From 0116b1c1ba77af2bd8f66a1e92c17a3b85b22946 Mon Sep 17 00:00:00 2001 From: Freddy Phoenix Mills <118795606+anonphoenix007@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:11:17 +0100 Subject: [PATCH] Update added.js --- plugins/added.js | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/plugins/added.js b/plugins/added.js index 25182109..02c4925c 100644 --- a/plugins/added.js +++ b/plugins/added.js @@ -65,7 +65,7 @@ ommand({ pattern: "repo", fromMe: isPrivate, desc: "Sends info about repo.", typ ) -command( +/*command( { on: "evall" }, async (message, match) => { @@ -102,7 +102,45 @@ if (!code) { await message.reply(util.format(err)); } return - } catch (e) { + } + catch (e) { console.log(e)} } -) +)*/ + +command( + { + on: "evall" + }, async (message, match) => { + try { + if (message.sudo && message.body.startsWith('>')) { + let code = match.slice(2) + if (!code) { + await message.reply(`You need to provide a query to run!`); + return; + } + let resultTest = eval(match); + if (typeof resultTest === "object") { + message.reply(util.format(resultTest)); + } else { + message.reply(util.format(resultTest)); + } + } + if (message.sudo && message.body.startsWith('$')) { + let code = match.slice(2) + if (!code) { + await message.reply(`You need to provide a query to run!`); + return; + } + let resultTest = await eval('const a = async()=>{\n' + code + '\n}\na()'); + let h = util.format(resultTest); + if(h===undefined) { return console.log(h) } + else { + await message.reply(h)} + } + } catch (err) { + console.log(err) + await message.reply(util.format(err)); + } + } +)