DuckySoLucky / hypixel-discord-chat-bridge

A two-way chat bridge between Hypixel guild chat and a Discord channel. The application utilizes discord.js v14 for communicating with Discord, and mineflayer for communicating with Hypixel.
47 stars 37 forks source link

Bot doesn't like Russian characters - throws TypeError #171

Open DSSoftware opened 1 year ago

DSSoftware commented 1 year ago

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

DuckySoLucky commented 1 year ago

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 ;-;

DSSoftware commented 1 year ago

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.

DSSoftware commented 1 year ago

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

Kathund commented 1 month ago

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 ;-;

Ducky is right on this. We can't do much about this. There's and issue already opened on the packages repo. #174