From f113d7756044e7285e463c5358892790890c5691 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sun, 25 Jul 2021 11:38:21 -0600 Subject: [PATCH] eval multiline --- bot.js | 2 +- commands/dev/eval.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bot.js b/bot.js index 9216ae2..2d483cc 100644 --- a/bot.js +++ b/bot.js @@ -80,6 +80,6 @@ async function init() { client.guildconfig.logs = new Map(); - await require('./events/ready')(client); + await require('./util/wait')(10000).then(async () => {if (!client.misc.readied) {await require('./events/ready')(client);}}); } init().then(() => {}); \ No newline at end of file diff --git a/commands/dev/eval.js b/commands/dev/eval.js index 909d08f..6884de8 100644 --- a/commands/dev/eval.js +++ b/commands/dev/eval.js @@ -19,13 +19,21 @@ module.exports = { let timer = new Date().getTime(); if (!client.developers.includes(message.author.id)) {return message.channel.send("Sorry, but I've got trust issues, so only me devs can go commanding me around like that.");}; - if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval \``); + if (!args.length) return message.channel.send(`Syntax: \`${prefix}eval \``); - let options = new TagFilter([new Tag(['s', 'silent', 'nr', 'noreply'], 'silent', 'toggle')]).test(args[0]); - if (options.silent) {args.shift();} + if (!args.length) {return message.reply("Please specify a bio!");} + let args2 = msg.startsWith(prefix) + ? message.content.slice(prefix.length).trim().split(/ +/g) + : msg.startsWith('<@!') + ? message.content.slice(4 + client.user.id.length).trim().split(/ +/g) + : message.content.slice(3 + client.user.id.length).trim().split(/ +/g); + args2.shift(); args2.shift(); + + let options = new TagFilter([new Tag(['s', 'silent', 'nr', 'noreply'], 'silent', 'toggle')]).test(args2[0]); + if (options.silent) {args2.shift();} if (!args.length) {return message.channel.send("Silly goose, if you want me to do something, you have to tell me what!");} - const result = new Promise((resolve) => resolve(eval(args.join(' ')))); + const result = new Promise((resolve) => resolve(eval(args2.join(' ')))); return result.then((output) => { if (typeof output !== 'string') { output = require('util').inspect(output, {depth: 0});