mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
const mc = require('minecraft-protocol')
|
|
const crypto = require('crypto')
|
|
const colorConvert = require('color-convert')
|
|
const generateEaglerUsername = require('../util/generateEaglerUsername')
|
|
const uuid = require('uuid-by-string')
|
|
const moment = require('moment-timezone')
|
|
const cowsay = require('cowsay2')
|
|
const cows = require('cowsay2/cows')
|
|
const { VM } = require('vm2')
|
|
const randomstring = require('randomstring')
|
|
const mineflayer = require('mineflayer')
|
|
function inject (bot) {
|
|
const chatMessage = require('prismarine-chat')(bot.version)
|
|
const mcData = require('minecraft-data')(bot.version)
|
|
bot.vmoptions = {
|
|
timeout: 2000,
|
|
sandbox: {
|
|
run (cmd) {
|
|
bot.core.run(cmd)
|
|
},
|
|
mc,
|
|
mineflayer,
|
|
chat: bot.chat,
|
|
moment,
|
|
randomstring,
|
|
uuid,
|
|
chatMessage,
|
|
crypto,
|
|
colorConvert,
|
|
bruhifyText (message) {
|
|
if (
|
|
typeof message !== 'string'
|
|
) throw new SyntaxError('message must be a string')
|
|
bot.bruhifyText = message.substring(0, 1000)
|
|
},
|
|
generateEaglerUsername,
|
|
cowsay,
|
|
cows,
|
|
mcData
|
|
}
|
|
}
|
|
bot.vm = new VM(bot.vmoptions)
|
|
};
|
|
|
|
module.exports = { inject }
|