• Share this text:
Report Abuse
Untitled - posted by guest on 29th May 2020 01:25:57 PM

bot.on("message", async (message) => {

  if(!["419491707466547204", "447479189717778435"].includes(message.author.id)) return

  if(!message.content.startsWith("@eval")) return

  const args = message.content.split(" ").slice(1);

  function clean(text) {

    if (typeof(text) === "string")

      return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));

    else

        return text;

  }

  try {

      const code = args.join(" ");

      let evaled = eval(code);

 

      if (typeof evaled !== "string")

        evaled = require("util").inspect(evaled);

 

      message.channel.send(clean(evaled), {code:"xl"});

    } catch (err) {

      message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);

    }

})

Report Abuse

Login or Register to edit or copy and save this text. It's free.