mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
remove comments
This commit is contained in:
parent
f3aa1a6fd9
commit
a6ecadeff7
1 changed files with 1 additions and 88 deletions
89
index.js
89
index.js
|
@ -58,30 +58,6 @@ let chomenschannel = '969773424387981356';
|
|||
const hashchannel = '980438368422871151';
|
||||
const ownerhashchannel = '980786390247833620';
|
||||
|
||||
/**
|
||||
* Error
|
||||
* @param {*} err
|
||||
*/
|
||||
// async function onerror(err) {
|
||||
// try {
|
||||
// console.log(`INFO: Disconnected: ${err}`);
|
||||
// fs.appendFileSync('./logs.txt', `INFO: Disconnected: ${err}\r\n`);
|
||||
// const Embed = new MessageEmbed()
|
||||
// .setColor('#FF0000')
|
||||
// .setTitle(`${err.message ?? 'Disconnected'}`)
|
||||
// .setDescription(`\`\`\`text\n${err}\`\`\``);
|
||||
// channel.send({embeds: [Embed]});
|
||||
// if (err.includes('issued "end" command')) {
|
||||
// bot.chat('Restarting...');
|
||||
// }
|
||||
// await sleep(1000);
|
||||
// bot.end();
|
||||
// bot._client = mc.createClient(bot.options);
|
||||
// } catch (e) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* empty function for discord message
|
||||
* @return {String}
|
||||
|
@ -182,18 +158,6 @@ function main() {
|
|||
bot.chat = (message) => {
|
||||
bot.queue.push(String(message));
|
||||
};
|
||||
// fixCmdBlocksOnlyCore=(core)=>{
|
||||
// const cmd = `/minecraft:fill ${Math.floor(bot.position.x)} 0 ${Math.floor(bot.position.z)} ${Math.floor(bot.position.x + 15)} 63 ${Math.floor(bot.position.z + 15)} command_block{CustomName: '{"text":"ChomeNS Bot Core","color":"yellow"}'} replace`;
|
||||
// if (core===true) {
|
||||
// bot.core.run(cmd);
|
||||
// } else {
|
||||
// bot.chat(cmd);
|
||||
// }
|
||||
// };
|
||||
// fixCmdBlocks=()=>{
|
||||
// bot.chat('/essentials:world world');
|
||||
// fixCmdBlocksOnlyCore();
|
||||
// };
|
||||
|
||||
discordQueue = setInterval(function() {
|
||||
if (dcmsg.queue!='') {
|
||||
|
@ -239,7 +203,6 @@ function main() {
|
|||
});
|
||||
|
||||
console.log(`Connecting to: ${bot.options.host}:${bot.options.port}...`);
|
||||
// fs.appendFileSync('./logs.txt', `\r\Connecting to: ${bot.options.host}:${bot.options.port}...\r\n`);
|
||||
channel.send(`Connecting to: \`${bot.options.host}:${bot.options.port}\`...`);
|
||||
bot._client.on('login', async function(data) {
|
||||
bot.entityId = data.entityId;
|
||||
|
@ -248,7 +211,6 @@ function main() {
|
|||
chatMessage = require('prismarine-chat')(bot.version);
|
||||
const mcData = require('minecraft-data')(bot.version);
|
||||
console.log(`Successfully logged in to: ${bot.options.host}:${bot.options.port}`);
|
||||
// fs.appendFileSync('./logs.txt', `\r\nSuccessfully logged in to: ${bot.options.host}:${bot.options.port}\r\n`);
|
||||
channel.send(`Successfully logged in to: \`${bot.options.host}:${bot.options.port}\``);
|
||||
previusMessage = undefined;
|
||||
loginfinish = false;
|
||||
|
@ -281,14 +243,6 @@ function main() {
|
|||
cows,
|
||||
mcData,
|
||||
},
|
||||
// require: {
|
||||
// mock: {
|
||||
// run: run,
|
||||
// randomchar: randomchar,
|
||||
// chat: bot.chat,
|
||||
// mineflayer: mineflayer
|
||||
// }
|
||||
// }
|
||||
};
|
||||
bot.vm = new VM(bot.vmoptions);
|
||||
|
||||
|
@ -318,8 +272,6 @@ function main() {
|
|||
|
||||
consoleQueue.push(message.toAnsi());
|
||||
|
||||
// fs.appendFileSync('./logs.txt', `${bot.options.host}: ${message.toMotd()}\r\n`);
|
||||
// if (discordMsg)return channel.send(`${discordMsg.substring(0, 2000)}`)
|
||||
if (message.toMotd().startsWith('§8[§eChomeNS §9Discord§8] §c')) return;
|
||||
dcmsg.queue += '\n' + discordMsg;
|
||||
} catch (e) {
|
||||
|
@ -327,35 +279,6 @@ function main() {
|
|||
}
|
||||
});
|
||||
|
||||
// bot.on('message', async function(username, message, sender) {
|
||||
// try {
|
||||
// const usernameraw = username;
|
||||
// // let username = usernameraw.replace(/§[a-f0-9rlonmk]/g, "").replace(/§/g, "");
|
||||
// const messageraw = message;
|
||||
// var username = getplayerusername[sender];
|
||||
// var message = messageraw.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
// // if (username===bot.username)return
|
||||
// // console.log(username + ': ' + message);
|
||||
// allCommands(username, message, usernameraw, sender);
|
||||
// } catch (e) {
|
||||
// console.log(e);
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.on('cspy', async function(username, message) {
|
||||
// // eslint-disable-next-line no-redeclare
|
||||
// var username = username.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
// // eslint-disable-next-line no-redeclare
|
||||
// var message = message.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
// const args = message.substring(5).trim().split(' ');
|
||||
// args[0] = args[0].toLowerCase();
|
||||
// try {
|
||||
// allCommands(username, message, username, '00000000-0000-0000-0000-000000000000');
|
||||
// } catch (e) {
|
||||
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: String(e), color: 'red'}));
|
||||
// }
|
||||
// });
|
||||
|
||||
bot.on('player_added', (player) => {
|
||||
bot.playersAddedPlayers[player.name] = player.UUID;
|
||||
bot.getplayerusername[player.UUID] = player.name;
|
||||
|
@ -363,17 +286,13 @@ function main() {
|
|||
|
||||
bot._client.on('end', function(reason) {
|
||||
bot.emit('end', reason, 'end');
|
||||
// onerror('end event: ' + util.inspect(reason).replaceAll('runner', 'chayapak1'));
|
||||
});
|
||||
|
||||
bot._client.on('keep_alive', (packet) => bot.write('keep_alive', {keepAliveId: packet.keepAliveId}));
|
||||
|
||||
// bot._client.on('tab_complete', (packet) => bot.tabcompleteplayers = packet.matches);
|
||||
|
||||
bot._client.on('kick_disconnect', function(data) {
|
||||
const parsed = JSON.parse(data.reason);
|
||||
bot.emit('end', parsed, 'kick_disconnect');
|
||||
// onerror('kick_disconnect event: ' + util.inspect(reason));
|
||||
});
|
||||
|
||||
bot._client.on('disconnect', function(data) {
|
||||
|
@ -381,11 +300,7 @@ function main() {
|
|||
bot.emit('end', parsed, 'disconnect');
|
||||
});
|
||||
|
||||
bot._client.on('error', function() {
|
||||
// console.log('Error: ' + util.inspect(error));
|
||||
// channel.send('Error: ' + util.inspect(error));
|
||||
// onerror('error event: ' + util.inspect(err).replaceAll('runner', 'chayapak1'));
|
||||
});
|
||||
bot._client.on('error', function() {});
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.log('uncaught ' + util.inspect(error));
|
||||
|
@ -435,7 +350,6 @@ dcclient.on('ready', async () => {
|
|||
if (line.toLowerCase()==='' || line.toLowerCase().startsWith(' ')) return;
|
||||
if (line.toLowerCase()==='.exit' || line.toLowerCase()==='.end') {
|
||||
bot.emit('end', 'end command');
|
||||
// onerror('Console issued "end" command, rebooting bot...');
|
||||
return;
|
||||
}
|
||||
if (line.toLowerCase().startsWith('.servereval ')) {
|
||||
|
@ -460,7 +374,6 @@ dcclient.on('ready', async () => {
|
|||
return;
|
||||
}
|
||||
if (line==='.kill') process.exit();
|
||||
// if (line.startsWith("."))return console.log('command not found')
|
||||
if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid');
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]));
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue