1
0
Fork 0
mirror of https://github.com/ChomeNS/chomens-bot-mc.git synced 2024-12-19 20:02:21 -05:00
chomens-bot-js/commands/eval.js

52 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
const {VM} = require('vm2');
const axios = require('axios');
const util = require('util');
const querystring = require('querystring');
const {stylize} = require('../util/colors/minecraft');
module.exports = {
name: 'eval',
alias: [],
description: 'Safe eval 100% secure!!!',
trusted: 0,
2022-08-25 06:04:43 -04:00
usage: '<run|reset|server> <code>',
2022-08-14 05:51:45 -04:00
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0]==='run') {
try {
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(bot.vm.run(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'}));
}
}
if (args[0]==='reset') {
bot.vm = new VM(bot.vmoptions);
}
if (args[0]==='server') {
axios
.post('http://192.168.1.105:4445/', querystring.stringify({
html: false,
showErrorMsg: false,
colors: 'minecraft',
code: args[1],
})).then((res) => {
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${res.data}`}));
}).catch((e) => {
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${e}`, color: 'red'}));
});
}
2022-08-25 06:04:43 -04:00
// if (args[0]==='dineval') {
// axios
// .get('https://eval.dinhero21.repl.co', {
// headers: {
// data: args[1],
// colors: 'minecraft',
// },
// }).then((res) => {
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${res.data}`}));
// }).catch((e) => {
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${e}`, color: 'red'}));
// });
// }
2022-08-14 05:51:45 -04:00
},
};