diff --git a/index.js b/index.js index 67d4e25..a91ab3f 100644 --- a/index.js +++ b/index.js @@ -174,7 +174,7 @@ function main() { }; dcmsg.queue = ''; - consoleQueue = ''; + consoleQueue = []; bot.playersAddedPlayers = {}; bot.getplayerusername = {}; @@ -212,9 +212,9 @@ function main() { }, 1000); consoleQueueInterval = setInterval(function() { - if (consoleQueue!='') { - console.log(bot.options.host + ': ' + consoleQueue.substring(0, 10000)/* message.toAnsi() + '\u001b[0m'*/); - consoleQueue = ''; + if (consoleQueue[0] || consoleQqueue[0]==='') { + console.log(bot.options.host + ': ' + consoleQueue[0].substring(0, 10000)/* message.toAnsi() + '\u001b[0m'*/); + consoleQueue.shift(); } }, 100); @@ -306,7 +306,7 @@ function main() { const cleanMessage = escapeMarkdown(message.toString()); discordMsg = /* '_ _ ' + */cleanMessage.replaceAll('@', '@\u200B').replaceAll('http', '[http]');// .replace(/[\r\n]/gm, '\n') - consoleQueue += message.toAnsi(); + consoleQueue.push(message.toAnsi()); // fs.appendFileSync('./logs.txt', `${bot.options.host}: ${message.toMotd()}\r\n`); // if (discordMsg)return channel.send(`${discordMsg.substring(0, 2000)}`)