SHARE
TWEET

Untitled

a guest Sep 16th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Eval function
  2. function clean(text) {
  3.   if (typeof(text) === "string")
  4.     return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
  5.   else {
  6.       return text;
  7.   }
  8. }
  9.  
  10. function evalCode(args) {
  11.   client.on("message", message => {
  12.     const args = message.content.split(" ").slice(1);
  13.    
  14.     if (message.content.startsWith(prefix + "eval")) {
  15.       if(message.author.id !== ownerID) return;
  16.       try {
  17.         const code = args.join(" ");
  18.         let evaled = eval(code);
  19.    
  20.         if (typeof evaled !== "string")
  21.           evaled = require("util").inspect(evaled);
  22.    
  23.         message.channel.send(clean(evaled), {code:"xl"})
  24.           .then(message => console.log('Sent #' + message.id + ': ' + message.content))
  25.           .catch(console.error);
  26.       } catch (err) {
  27.         message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
  28.       }
  29.     }
  30.   });
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top