Skip to content

Commit

Permalink
Add config option "show-private-chat"
Browse files Browse the repository at this point in the history
Party chat messages can now be re-enabled by toggling the option "show-private-chat"
  • Loading branch information
LakeYS committed Feb 17, 2019
1 parent e9e15b4 commit 63cb720
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"disable-chatmsgs": false,
"disable-join-leave-gmsgs": false,
"disable-misc-gmsgs": false,
"show-private-chat": false,
"disable-status-updates": false,
"disable-version-check": false,
"hide-prefix": false,
Expand Down
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ function handleMsgFromGame(line) {
msg = msg + " " + split[i];
}


// Replace the source information
if(type === "Chat") {
// For reasons unknown, sometimes messages are limited to exactly 64 characters.
Expand All @@ -164,17 +163,21 @@ function handleMsgFromGame(line) {
return;
}

msg = msg.replace(/ *\([^)]*\): */, "");

var checkString = "'Global'):";

if(split[10] !== checkString && split[11] !== checkString) {
console.log("Non-global detected, message will not send");
return;
if(config["show-private-chat"]) {
msg = `*(Private)* ${msg}`;
}
else {
return;
}
}

msg = msg.replace(/ *\([^)]*\): */, "");
}


if(config["log-messages"]) {
console.log(msg);
}
Expand Down

0 comments on commit 63cb720

Please sign in to comment.