DuckySoLucky/hypixel-discord-chat-bridge

Bot doesn't like Russian characters - throws TypeError

DSSoftware opened this issue · 4 comments

How to reproduce:

Message like абв causes the bot to throw TypeError:

TypeError: Cannot read properties of null (reading '0')
    at Filter.clean (/home/node/bridge/node_modules/bad-words/lib/badwords.js:58:41)
    at MinecraftManager.onBroadcast (/home/node/bridge/src/minecraft/MinecraftManager.js:98:26)
    at DiscordManager.broadcastMessage (/home/node/bridge/src/contracts/CommunicationBridge.js:15:24)
    at MessageHandler.onMessage (/home/node/bridge/src/discord/handlers/MessageHandler.js:33:18)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Needs more testing, as I'm running the #169 version of the bot, but I doubt the fix broke filter

Seems like issue with bad-words package, I have been really busy for past few weeks and will be for like 2 weeks more. So sorry won't be able to make fix or check that out ;-;

Well, don't think that's critical. I'll look into it after, but I doubt there's a lot of Russian users with this bot lol.
The only critical-ish thing is that it crashes for me.

But idk i literally rewrote the entire startup sequence so it starts in a cluster, so that might be the issue with crashing.

Also, is it ok to continue after getting uncaughtException?

The correct use of 'uncaughtException' is to perform synchronous cleanup of allocated resources (e.g. file descriptors, handles, etc) before shutting down the process. It is not safe to resume normal operation after 'uncaughtException'.

https://github.com/DuckySoLucky/hypixel-discord-chat-bridge/blob/4ec232b06df3f71da8b2d1ef360f1459f6b73ba2/index.js#L1C1-L1C64