mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-12-18 03:12:23 -05:00
22 lines
781 B
JavaScript
22 lines
781 B
JavaScript
|
/* 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) {
|
||
|
if (args[0]===bot.ownerHash) {
|
||
|
try {
|
||
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}));
|
||
|
} catch (err) {
|
||
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'}));
|
||
|
}
|
||
|
} else {
|
||
|
throw new Error('Invalid OwnerHash');
|
||
|
}
|
||
|
},
|
||
|
};
|