[Bug] User Defined chat format isn't matching when MarkSystemMessage is set to true
Using 20230129-189 ~~and checking over source currently available.~~
~~In MinecraftClient/Scripting/ChatBot.cs~~
~~See Lines 589 and 700 for Public and Private~~
~~if (regexMatch.Success && regexMatch.Groups.Count >= 3)~~
~~This if statement requires 3 matches despite only 2 being needed. (sender and message)~~
~~See Line 803 for TeleportRequest:~~
~~if (regexMatch.Success && regexMatch.Groups.Count >= 2)~~
~~This if statement requires 2 matches despite only 1 being needed. (sender)~~
~~These also do not match up properly with the examples left in the config, which contain the expected amount (2 for Private and Public and 1 for TeleportRequest).~~
EDIT::: I was incorrect as to why the matches weren't working. Thanks ReinforceZwei for the information there. After further testing I found that whenever I have MarkSystemMessage under Signature set to true, the bot no longer seems to recognize that I've whispered it a command or sent it a teleport request. I've not yet further tested public chat interacts as I tend to use private/teleport requests.
It is because group 0 will always contain the whole text, then the captured groups. Therefore, the count will be number of capture groups + 1.
You can check out this example code snippet to see how it works.
Okay, so why isn't the user defined working unless I add in extra match groups?
Once I added an extra one in for public, private, and teleported request, then it started working. Otherwise if I only leave the ones needed to be pulled from the command, it doesn't work.
Okay, well... my apologies. I removed the extra capture group and it's working now. Only thing I can think is there was a bad copy/paste when I transferring it from my old 1.18.x configs. Sorry for that -- thanks!
I did some more testing and restored my config from when it was not working. Turns on my regex wasn't any different, but I found that
MarkSystemMessage was set to true.
I tested this again with my working config. If I set that value to true, the public/private/teleport requests no longer work.
I apologize for the slew of messages here, I'm posting things as I find them.
The private messages/whispers being sent are being seen as system messages. When I turn that option to false, it doesn't have the color block and the regex succeeds.
Adding that block character into my regex (the ▌) allows the regex match to succeed then. I'm not sure if it is intended for those to go into the messages being checked against, but I hope that helps.
Thanks for your time and your help!
Adding that block character into my regex (the ▌) allows the regex match to succeed then. I'm not sure if it is intended for those to go into the messages being checked against, but I hope that helps.
This is most likely not intended and should probably be filed as an issue.