NanderTGA / msgroom-orm

A MsgRoom client.
https://nandertga.github.io/msgroom-orm/
MIT License
4 stars 0 forks source link

fix: correctly deal with blocked users #149

Closed NanderTGA closed 10 months ago

NanderTGA commented 10 months ago

Recently, Yabluzo and other bots on recent versions have started crashing now and then. I have been aware of this issue for some time now and have been able to log some of the events that caused one of these undefined errors. These logs indicate that a message event is sometimes handled before the user-join event assigns a new user to client.users. However, this is impossible because these event handlers are all synchronous and socket.io guarantees that all events are received (and thus have their event handlers run) in the same order they were sent.

My conclusion is that client.users[user] must be undefined for some other reason. I think this may be related to a recent change that introduced blocking bots using Sheesh's bot API. I have also noticed that the crashes seem to happen for bots or people who have the same ID as a bot. I will investigate further.

NanderTGA commented 10 months ago

I think this may be related to my poor handling of user-join and user-leave events for blocked users. The client.isBlocked function recently started blocking bots too (by default), which explains why this started happening recently.

msgroom-js-semantic-release[bot] commented 9 months ago

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: