chomens-bot-js/commands/servereval.js

22 lines
710 B
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');
module.exports = {
name: 'servereval',
alias: [],
description: 'Eval command without vm2',
trusted: 2,
usage: '<ownerhash> <code>',
execute: function(bot, username, usernameraw, sender, prefix, args) {
2022-11-07 07:26:38 -05:00
if (args[0] === bot.ownerHash) {
2022-08-14 05:51:45 -04:00
try {
bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
2022-08-14 05:51:45 -04:00
} catch (err) {
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
2022-08-14 05:51:45 -04:00
}
} else {
throw new Error('Invalid OwnerHash');
}
},
};