chomens-bot-js/commands/servereval.js

34 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
const util = require('util');
const {stylize} = require('../util/colors/minecraft');
const {MessageEmbed} = require('discord.js');
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'servereval',
alias: [],
description: 'Basically eval command but without vm2',
2022-08-14 05:51:45 -04:00
trusted: 2,
usage: '<ownerhash> <code>',
2022-11-16 06:41:30 -05:00
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
try {
bot.tellraw(selector, {text: util.inspect(eval(args.slice(1).join(' ')), {stylize}).substring(0, 32766)});
} catch (err) {
bot.tellraw(selector, {text: util.inspect(err).replaceAll('runner', 'chayapak1'), color: 'red'});
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
try {
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Output')
.setDescription(util.inspect(eval(args.join(' ')), {stylize}));
channeldc.send({embeds: [Embed]});
} catch (err) {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setTitle('Error')
.setDescription(`\`\`\`${util.inspect(err).replaceAll('runner', 'chayapak1')}\`\`\``);
channeldc.send({embeds: [Embed]});
2022-08-14 05:51:45 -04:00
}
},
};