mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -05:00
remove ancient unused comments
This commit is contained in:
parent
3e19df5bc7
commit
ee1ddd46e3
5 changed files with 3 additions and 64 deletions
8
bot.js
8
bot.js
|
@ -28,11 +28,11 @@ const mineflayer = require('mineflayer');
|
||||||
async function createBot(server, config, getBots, dcclient, rl) {
|
async function createBot(server, config, getBots, dcclient, rl) {
|
||||||
const bot = new EventEmitter();
|
const bot = new EventEmitter();
|
||||||
bot.options = {
|
bot.options = {
|
||||||
username: /* process.argv[2] */ !server.kaboom ?
|
username: !server.kaboom ?
|
||||||
'ChomeNS_Bot' :
|
'ChomeNS_Bot' :
|
||||||
randomstring.generate(8),
|
randomstring.generate(8),
|
||||||
host: /* process.argv[2] */ server.host,
|
host: server.host,
|
||||||
port: /* process.argv[3] ? Number(process.argv[3]) : 25565*/ server.port,
|
port: server.port,
|
||||||
version: config.version,
|
version: config.version,
|
||||||
kaboom: server.kaboom,
|
kaboom: server.kaboom,
|
||||||
checkTimeoutInterval: '30000',
|
checkTimeoutInterval: '30000',
|
||||||
|
@ -75,8 +75,6 @@ async function createBot(server, config, getBots, dcclient, rl) {
|
||||||
`Successfully logged in to: \`${bot.options.host}:${bot.options.port}\``,
|
`Successfully logged in to: \`${bot.options.host}:${bot.options.port}\``,
|
||||||
);
|
);
|
||||||
bot.eaglercrashstarted = false;
|
bot.eaglercrashstarted = false;
|
||||||
// await sleep(1500);
|
|
||||||
// bot.createCore();
|
|
||||||
|
|
||||||
bot.vmoptions = {
|
bot.vmoptions = {
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
|
|
|
@ -39,19 +39,6 @@ module.exports = {
|
||||||
bot.tellraw(selector, {text: `${err}`, color: 'red'});
|
bot.tellraw(selector, {text: `${err}`, color: 'red'});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if (args[0] === 'dineval') {
|
|
||||||
// axios
|
|
||||||
// .get('https://eval.dinhero21.repl.co', {
|
|
||||||
// headers: {
|
|
||||||
// data: args[1],
|
|
||||||
// colors: 'minecraft',
|
|
||||||
// },
|
|
||||||
// }).then((res) => {
|
|
||||||
// bot.tellraw(selector, {text: `${res.data}`}));
|
|
||||||
// }).catch((e) => {
|
|
||||||
// bot.tellraw(selector, {text: `${e}`, color: 'red'});
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0] === 'run') {
|
if (args[0] === 'run') {
|
||||||
|
|
|
@ -31,25 +31,10 @@ function inject(bot, _dcclient, config, rl) {
|
||||||
log(prefix('&cERROR', typeof error === 'string' ? error : error.stack));
|
log(prefix('&cERROR', typeof error === 'string' ? error : error.stack));
|
||||||
};
|
};
|
||||||
|
|
||||||
// bot.consoleQueue = [];
|
|
||||||
// const consoleQueueInterval = setInterval(function() {
|
|
||||||
// if (!bot.messageLogging) return;
|
|
||||||
// if (bot.consoleQueue.length > 50) bot.consoleQueue = [];
|
|
||||||
// if (bot.consoleQueue[0] || bot.consoleQueue[0] === '') {
|
|
||||||
// bot.console.log(bot.consoleQueue[0].substring(0, 10000));
|
|
||||||
// bot.consoleQueue.shift();
|
|
||||||
// }
|
|
||||||
// }, 100);
|
|
||||||
|
|
||||||
bot.on('parsed_chat', (message) => {
|
bot.on('parsed_chat', (message) => {
|
||||||
if (!bot.messageLogging) return;
|
if (!bot.messageLogging) return;
|
||||||
bot.console.log(message.toAnsi());
|
bot.console.log(message.toAnsi());
|
||||||
});
|
});
|
||||||
|
|
||||||
// bot.once('end', () => {
|
|
||||||
// clearInterval(consoleQueueInterval);
|
|
||||||
// rl.removeAllListeners();
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function oneTimeInject(bot, _dcclient, config, rl) {
|
function oneTimeInject(bot, _dcclient, config, rl) {
|
||||||
|
@ -86,17 +71,11 @@ function oneTimeInject(bot, _dcclient, config, rl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (line === '.clearconsolequeue') {
|
|
||||||
// consoleQueue = [];
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (line === '.messagelogging on') {
|
if (line === '.messagelogging on') {
|
||||||
bot.consoleQueue = [];
|
|
||||||
bot.messageLogging = true;
|
bot.messageLogging = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (line === '.messagelogging off') {
|
if (line === '.messagelogging off') {
|
||||||
bot.consoleQueue = [];
|
|
||||||
bot.messageLogging = false;
|
bot.messageLogging = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,15 +93,6 @@ function inject(bot, dcclient, config) {
|
||||||
bot.console.error(e);
|
bot.console.error(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// fillCore(useCore) {
|
|
||||||
// const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block{CustomName:'{"text":"ChomeNS Bot Core","color":"yellow"}'}`;
|
|
||||||
// if (useCore==true) {
|
|
||||||
// bot.core.run(fillCommand);
|
|
||||||
// } else {
|
|
||||||
// bot.chat(fillCommand);
|
|
||||||
// }
|
|
||||||
// bot.emit('core_filled');
|
|
||||||
// },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function fillCore() {
|
function fillCore() {
|
||||||
|
@ -113,21 +104,12 @@ function inject(bot, dcclient, config) {
|
||||||
core.end = core.start.clone().translate(16, config.core.layers, 16).subtract(new Vec3(1, 1, 1));
|
core.end = core.start.clone().translate(16, config.core.layers, 16).subtract(new Vec3(1, 1, 1));
|
||||||
|
|
||||||
bot.core.loopPlace();
|
bot.core.loopPlace();
|
||||||
// core.fillCore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bot.on('position', fillCore);
|
bot.on('position', fillCore);
|
||||||
|
|
||||||
const interval = setInterval(() => fillCore(), config.core.refillInterval);
|
const interval = setInterval(() => fillCore(), config.core.refillInterval);
|
||||||
|
|
||||||
// bot._client.on('block_change', (packet) => {
|
|
||||||
// if (core.isCore(packet.location) && packet.type === 0) fillCore();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// bot._client.on('multi_block_change', (packet) => {
|
|
||||||
// if (core.start === packet.chunkCoordinates || core.end === packet.chunkCoordinates) fillCore();
|
|
||||||
// });
|
|
||||||
|
|
||||||
bot.once('end', () => {
|
bot.once('end', () => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,30 +47,23 @@ function parsePlayerMessages(message, packet, bot) {
|
||||||
// then here is all the player message parsing thing
|
// then here is all the player message parsing thing
|
||||||
const raw = message.toMotd().substring(0, 32767);
|
const raw = message.toMotd().substring(0, 32767);
|
||||||
if (raw.match(/.* .*: .*/g)) {
|
if (raw.match(/.* .*: .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
||||||
const message = raw.split(': ')[1];
|
const message = raw.split(': ')[1];
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/.* .*\u203a .*/g)) {
|
} else if (raw.match(/.* .*\u203a .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
||||||
const message = raw.split('\u203a ')[1].substring(2);
|
const message = raw.split('\u203a ')[1].substring(2);
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
||||||
const message = raw.split('\u00BB ')[1].substring(2);
|
const message = raw.split('\u00BB ')[1].substring(2);
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/<.*§r> .*/g)) {
|
} else if (raw.match(/<.*§r> .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
|
||||||
|
|
||||||
const username = raw.substring(3).split('§r>')[0];
|
const username = raw.substring(3).split('§r>')[0];
|
||||||
const message = raw.split('§r> ')[1];
|
const message = raw.split('§r> ')[1];
|
||||||
|
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/<.*> .*/g)) {
|
} else if (raw.match(/<.*> .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
|
||||||
|
|
||||||
const username = raw.substring(3).split('>')[0];
|
const username = raw.substring(3).split('>')[0];
|
||||||
const message = raw.split('> ')[1];
|
const message = raw.split('> ')[1];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue