LakeYS / Dishorde

A Discord bridge bot for 7 Days to Die. Dishorde integrates a dedicated server with Discord, allowing players to access the game's chat from any device or location. Powered by discord.js.
http://lakeys.net/dishorde
MIT License
47 stars 27 forks source link

GMSG strings displaying incorrectly in Discord #118

Open LakeYS opened 3 years ago

LakeYS commented 3 years ago

image

Observed on a completely vanilla server.

LakeYS commented 2 years ago

Requires testing in new update

LakeYS commented 2 years ago

More reports of this in 2.0.0-rc1, as seen here: https://github.com/LakeYS/Dishorde/issues/119#issuecomment-1003005526

Player 'BigCone' left the2021-12-30T22:56:23 1796.155 INF Botman PlayerDisconnected2021-12-30T22:56:23 1796.155 INF Botman PlayerDisconnected
Player 'BigCone' left the game

And another quick-fix for the weird "left" messages, we can validate any message reading as "GMSG" to ensure it contains a whitelisted set of strings, being "died", "left the game", or "joined the game".

This would similarly be a temporary solution, and you would see a warning in console indicating that something is still wrong.

LakeYS commented 2 years ago

I've done some testing and found a potential cause, here's a breakdown:

In computer operating systems, there are a few different types of data that can indicate the ending of a line in text. These being CRLF, LF, and CR. Generally, you see LF (\r) in Linux and Mac, and CRLF (\r\n) in Windows. (This is somewhat simplified)

If you enable debug-mode in the new rc3 build, you'll see a new log that tells you which one the game is using. The result: It's actually mixing them, sometimes using LF and sometimes using CRLF. This is confusing both the telnet client and the bot's own system, which are configured to look for CRLF. In turn, this is causing the bot to not properly recognize where lines from the console are ending. I suspect that this is at least partially the cause. If mods are also using a different line ending, it would perfectly explain the mod conflicts as well.

I made a quick-fix change in rc3 that should at least partially remedy this, but we'll have to see how it performs in testing.

LakeYS commented 2 years ago

As of today, we've discovered that some lines are also being ended with CR. Detection and fixes are being adjusted accordingly: 02c6d84

image

LakeYS commented 2 years ago

Got another report of this via Discord following the aforementioned patch. Will move on to regex message screening/detection in an attempt to resolve this.

image