patch if comp[""] text is 0
This commit is contained in:
parent
877919ddbb
commit
b339d327c5
1 changed files with 4 additions and 5 deletions
|
@ -14,7 +14,7 @@ function parseCommand(message) {
|
|||
|
||||
function inject(bot) {
|
||||
bot.on('systemChat', (packet) => {
|
||||
// console.log(packet)
|
||||
console.log(packet)
|
||||
const jsonmsg = JSON.parse(packet.formattedMessage);
|
||||
const msg = parseMinecraftMessage(packet.formattedMessage);
|
||||
const nocolormsg = parseMinecraftMessageNoColor(packet.formattedMessage);
|
||||
|
@ -105,7 +105,7 @@ function parseMinecraftMessage(component) {
|
|||
if (comp.text) {
|
||||
text += comp.text;
|
||||
}
|
||||
if (comp[""]) {
|
||||
if (typeof comp[""] === 'string' || typeof comp[""] === 'number' && comp[""] !== undefined && comp[""] !== null) { // fix if text is {"":0} show false
|
||||
text += comp[""]; // after 1337 years, i found issue at here
|
||||
}
|
||||
if (typeof comp === 'string' || typeof comp === 'number') {
|
||||
|
@ -168,7 +168,6 @@ function parseMinecraftColor(color) {
|
|||
|
||||
function parseMinecraftFormat(format) {
|
||||
let result = '';
|
||||
console.log(format)
|
||||
if (format.bold) result += ansiFormatCodes['bold'];
|
||||
if (format.italic) result += ansiFormatCodes['italic'];
|
||||
if (format.underlined) result += ansiFormatCodes['underlined'];
|
||||
|
@ -193,7 +192,7 @@ function parseMinecraftMessageNoColor(component) {
|
|||
text += comp.text;
|
||||
}
|
||||
if (comp[""]) {
|
||||
text += extractText(comp[""]);
|
||||
text += comp[""];
|
||||
}
|
||||
if (typeof comp === 'string' || typeof comp === 'number') {
|
||||
text += comp;
|
||||
|
|
Loading…
Reference in a new issue