mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
messagelogging
This commit is contained in:
parent
cc1dd74801
commit
3780245861
1 changed files with 13 additions and 2 deletions
15
index.js
15
index.js
|
@ -105,8 +105,6 @@ function botThings() {
|
|||
hideErrors: true,
|
||||
};
|
||||
bot._client = mc.createClient(bot.options);
|
||||
bot.uuid = bot._client.uuid;
|
||||
bot.username = bot._client.username;
|
||||
bot.version = bot._client.version;
|
||||
bot.queue = [];
|
||||
bot.write = (name, data) => bot._client.write(name, data);
|
||||
|
@ -176,6 +174,8 @@ function main() {
|
|||
dcmsg.queue = '';
|
||||
consoleQueue = [];
|
||||
|
||||
bot.messageLoggingEnabled = true;
|
||||
|
||||
bot.playersAddedPlayers = {};
|
||||
bot.getplayerusername = {};
|
||||
|
||||
|
@ -212,6 +212,7 @@ function main() {
|
|||
}, 1000);
|
||||
|
||||
consoleQueueInterval = setInterval(function() {
|
||||
if (!bot.messageLoggingEnabled) return;
|
||||
if (consoleQueue.length > 50) consoleQueue = [];
|
||||
if (consoleQueue[0] || consoleQueue[0]==='') {
|
||||
console.log(bot.options.host + ': ' + consoleQueue[0].substring(0, 10000)/* message.toAnsi() + '\u001b[0m'*/);
|
||||
|
@ -224,6 +225,8 @@ function main() {
|
|||
channel.send(`Connecting to: \`${bot.options.host}:${bot.options.port}\`...`);
|
||||
bot._client.on('login', async function(data) {
|
||||
bot.entityId = data.entityId;
|
||||
bot.uuid = bot._client.uuid;
|
||||
bot.username = bot._client.username;
|
||||
const 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}`);
|
||||
|
@ -476,6 +479,14 @@ dcclient.on('ready', async () => {
|
|||
consoleQueue = [];
|
||||
return;
|
||||
}
|
||||
if (line==='.messagelogging on') {
|
||||
bot.messageLoggingEnabled = true;
|
||||
return;
|
||||
}
|
||||
if (line==='.messagelogging off') {
|
||||
bot.messageLoggingEnabled = false;
|
||||
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');
|
||||
|
|
Loading…
Reference in a new issue