Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Command = require('../Classes/Command'); const Discord = require('discord.js'); class Eval extends Command {
- constructor(client) {
- super(client, {
- name: 'eval',
- description: 'Evaluates JavaScript code.',
- category: 'Development',
- usage: ',eval [code]',
- aliases: ['e']
- });
- }
- async run(message, args) {
- if (message.author.id !== '630039758776827926') return message.author.send("You're not permitted to use the Eval Command!");
- let evaled;
- try {
- evaled = await eval(args.join(' ').trim());
- } catch (err) {
- const embed2 = new Discord.RichEmbed();
- //embed2.setAuthor(client.user.username, client.user.avatarURL);
- embed2.setColor('#FF0000');
- embed2.setTitle('JAVASCRIPT EVALUATION');
- embed2.setDescription(\ERROR`
- js\n${err}\n
- );
- embed2.setTimestamp();
- embed2.setFooter(${this.client.user.username} | Requested by ${message.author.username}#${message.author.discriminator}, this.client.user.avatarURL);
- return message.channel.send(embed2);
- }
- if (typeof evaled === 'string') {
- evaled = evaled.replace(this.client.token, '[TOKEN]');
- }
- if (typeof evaled === 'object') {
- evaled = require('util').inspect(evaled, {depth: 0});
- }
- if (evaled == undefined) {
- evaled = 'undefined';
- }
- if (evaled.length > 1900) {
- const overloadEmbed = new Discord.RichEmbed();
- overloadEmbed.setTitle('__JAVASCRIPT EVALUATION__');
- overloadEmbed.setColor('ORANGE');
- overloadEmbed.setDescription('The result was too long to be sent, please try again later.');
- overloadEmbed.setTimestamp();
- overloadEmbed.setFooter(${this.client.user.username} | Requested by ${message.author.username}#${message.author.discriminator}`,
- this.client.user.avatarURL);
- return message.channel.send(overloadEmbed);
- }
- const embed1 = new Discord.RichEmbed()
- //.setAuthor(client.user.username, client.user.avatarURL)
- .setColor('#00FF00')
- .setTitle('JAVASCRIPT EVALUATION')
- .setDescription(\``js\n${evaled}\n
- )
- .setTimestamp()
- .setFooter(${this.client.user.username} | Requested by ${message.author.username}#${message.author.discriminator}`, this.client.user.avatarURL);
- message.channel.send(embed1);
- }
- }
- module.exports = Eval;
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement