SHARE
TWEET

Untitled

a guest Dec 14th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ```js
  2. const Discord = require('discord.js');
  3. const config = require('../config.json');
  4. const log = require(`leekslazylogger`),
  5.       { inspect } = require("util"),
  6.       vm = require("vm");
  7. codeContext =  {};
  8. vm.createContext(codeContext);
  9. module.exports = {
  10.   name: 'eval',
  11.   description: 'не ебу. что сюда писать?',
  12.   usage: '[eval <code>]',
  13.   aliases: ['e'],
  14.   example: 'eval <code>',
  15.   args: false,
  16.   cooldown: config.cooldown,
  17.   guildOnly: true,
  18.   execute(message, args) {
  19.     if(!["tvoi id", "eshe id"].includes(message.author.id)) return
  20.     const client = message.client;
  21.     var guild = message.guild
  22.     var channel = message.channel
  23.     var author = message.author
  24.     let embed = new Discord.RichEmbed()
  25.     const code = args.join(" ");
  26.     const token = bot.token.split("").join("[^]{0,2}");
  27.     const rev = bot.token.split("").reverse().join("[^]{0,2}");
  28.     const filter = new RegExp(`${token}|${rev}`, "g");
  29.     try {
  30.         let hrDiff;
  31.         const hrStart = process.hrtime();
  32.         hrDiff = process.hrtime(hrStart);
  33.         let output = eval(code);
  34.         let asd = output;
  35.         if (output instanceof Promise || (Boolean(output) && typeof output.then === "function" && typeof output.catch === "function")) output = await output;
  36.         output = inspect(output, { depth: 0, maxArrayLength: null });
  37.         output = output.replace(filter, `[ ${bot.user.username} Token]`);
  38.         output = clean(output);
  39.         if (output.length < 1950) {
  40.             let embed = new Discord.RichEmbed()
  41.             .setAuthor(message.author.tag, message.author.avatarURL)
  42.             .setDescription(`\`\`\`fix\nOutput type: ${typeof asd}\nExecution time: ${hrDiff[0] > 0 ? `${hrDiff[0]}s ` : ''}${hrDiff[1] / 1000000}ms\nOutput:\`\`\`\n\`\`\`json\n\n${output}\n\`\`\``)
  43.             message.channel.send(embed).then(async m => {
  44.             await m.react('✅')
  45.             await m.react('📝')
  46.             let collector = m.createReactionCollector((reaction, user) => user.id === message.author.id)
  47.             collector.on("collect", async reaction => {
  48.             if(reaction.emoji.name === "✅"){
  49.             collector.stop();
  50.             m.delete();
  51.             } else if (reaction.emoji.name === "📝"){
  52.             message.author.send(`${args.join(' ')}`, { split: "\n", code: "js" });
  53.             }
  54.         });
  55.       });
  56.         } else {
  57.             message.author.send(`${output}`, { split: "\n", code: "js" });
  58.         }
  59.     } catch (error) {
  60.         let errbed = new Discord.RichEmbed()
  61.         .setAuthor(`Error`, message.author.avatarURL)
  62.         .setDescription(`Error \`\`\`js\n${error}\`\`\``)
  63.         message.channel.send(errbed);
  64.         message.react("🇫")
  65.     }
  66.  
  67.     function clean(text) {
  68.         return text
  69.             .replace(/`/g, "`" + String.fromCharCode(8203))
  70.             .replace(/@/g, "@" + String.fromCharCode(8203));
  71. }
  72.   },
  73. };```
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