mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-12-17 19:02:22 -05:00
76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
/* eslint-disable max-len */
|
|
/* eslint-disable require-jsdoc */
|
|
function inject(bot) {
|
|
let vanish = false;
|
|
let cspy = false;
|
|
let op = true;
|
|
let gameMode = 1;
|
|
let prefix = false;
|
|
let muted = false;
|
|
|
|
bot.on('parsed_chat', (data) => {
|
|
if (data.toString()==='You are now completely invisible to normal users, and hidden from in-game commands.') vanish = true;
|
|
if (!bot.visibility) {
|
|
if (data.toString().startsWith('Vanish for ') && data.toString().endsWith('disabled')) vanish = false;
|
|
}
|
|
if (data.toString()==='Successfully enabled CommandSpy' || data.toString()===' Enabled your command spy.' || data.toString()===' Your command spy is already enabled.') cspy = true;
|
|
if (data.toString()==='Successfully disabled CommandSpy' || data.toString()===' Disabled your command spy.') cspy = false;
|
|
if (data.toString()==='You now have the tag: [ChomeNS Bot]') {
|
|
prefix = true;
|
|
return;
|
|
}
|
|
if (data.toString().startsWith('You no longer have a tag')) prefix = false;
|
|
if (data.toString().startsWith('You now have the tag: ')) prefix = false;
|
|
if (data.toString().startsWith('You have been muted')) muted = true;
|
|
if (data.toString()==='You have been unmuted.') muted = false;
|
|
});
|
|
|
|
bot._client.on('entity_status', (data) => {
|
|
if (data.entityId !== bot.entityId) return;
|
|
|
|
switch (data.entityStatus) {
|
|
case 24:
|
|
op = false;
|
|
|
|
bot.emit('deop');
|
|
break;
|
|
case 28:
|
|
op = true;
|
|
|
|
bot.emit('op');
|
|
break;
|
|
}
|
|
|
|
bot.emit('entity_status', data);
|
|
});
|
|
|
|
bot._client.on('game_state_change', (data) => {
|
|
if (data.reason !== 3) return;
|
|
|
|
gameMode = data.gameMode;
|
|
});
|
|
|
|
bot._client.once('login', (data) => {
|
|
gameMode = data.gameMode;
|
|
});
|
|
|
|
const interval = setInterval(() => {
|
|
if (bot.options.host!=='0.tcp.ap.ngrok.io') {
|
|
if (!prefix) bot.chat('/extras:prefix &8[&eChomeNS Bot&8]');
|
|
if (!op) {
|
|
bot.chat('/minecraft:op @s[type=player]');
|
|
return;
|
|
}
|
|
}
|
|
if (!cspy) bot.chat('/commandspy:commandspy on');
|
|
if (!vanish) bot.chat('/essentials:vanish enable');
|
|
if (gameMode !== 1) bot.chat('/minecraft:gamemode creative @s[type=player]');
|
|
if (muted) bot.chat('/essentials:mute ' + bot.uuid);
|
|
}, 2000);
|
|
|
|
bot.once('end', () => {
|
|
clearInterval(interval);
|
|
});
|
|
}
|
|
|
|
module.exports = {inject};
|