Open UltimateGG opened 4 years ago
Ah so apparently removing the checkForChatPatterns function fixes this, but the problem is I need that to check for certain messages.
Ok I just added a if statement to check if it at least includes some of the patterns I would want, not fully a solution but fixes this for me.
Well this is a bug. Seems like regexp dos.
@Gamer745 Can you run your bot with DEBUG="minecraft-protocol"
and show me the output after typing /f who royal
to the chat?
This appears to be due to https://github.com/PrismarineJS/mineflayer/blob/030930dbb494188e4407d4f074aa945ecceb1009/lib/plugins/chat.js#L8
the username detection regex looks unnecessarily complex.
@extremeheat actually, there's a reason to that. We're matching many possible chat patterns at once.
Though I guess it could be replaced with (?:\\([^)]+\\)|\\[.[^\]]+\\]|.)*?(\\w+)
to be more strict.
Would be good to have unit tests for these patterns. So we can improve them without breaking what they parse
On Mon, Jan 18, 2021, 10:17 Kasper Seweryn notifications@github.com wrote:
@extremeheat https://github.com/extremeheat actually, there's a reason to that. We're matching many possible chat patterns at once. Though I guess it could be replaced with (?:\([^)]+\)|\[.[^]]+\]|.)*?(\w+) to be more strict.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/902#issuecomment-762107622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437QNNGPDYCAA4XXM43LS2P4DZANCNFSM4KLORIOQ .
Is there any way to fix this?
Can confirm, still happens. Bot goes and crashes randomly (probably a unsupported string) process hangs forever, and it just doesnt respond anymore.
This lag should have been fixed in https://github.com/PrismarineJS/mineflayer/pull/2350
Not a great regex but not really relevant anymore in 1.19+ since chat is now formatted on the client. We don't need regex anymore. Kind of surprised chat event wasn't updated in 1.19 update, but should be an easy fix to listen to message
and re-emit a chat
or whisper
:
Versions
node: 12.14.0
I came across this chat message (Im not sure what about it) but it completely hangs the entire nodejs app, and I have to restart it. This could be with minecraft protocol or chat messages with that, but im not sure.
Since im not sure what about it hangs the bot, its on the server manacube.net, on /server factions and the command "/f who royal"
It seems to work with any other faction on there. I do nothing with the output, it just runs the command and then the process stops. It could be too big of a message possibly? I do need a fix for this in that case or at least to return an error.
Message: