anjanms / DubAPI

A Node.js API for creating queup.net bots.
MIT License
20 stars 10 forks source link

user-join and user-leave events #36

Open kniffen opened 7 years ago

kniffen commented 7 years ago

The user-join event only seems to trigger every now and then But the user-leave event doesn't seem to get triggered at all

Reforced commented 6 years ago

+1

bot.getUsers() will be filled with all users since the bot joins a room; also the user-join event doesn't get triggered anymore. Made a quick fix myself by replacing case events.userJoin: with

case events.userJoin:
        // first remove to fix for broken userLeave
    if(this._.room.users.remove(this._.room.users.findWhere({id: msg.user._id}))) {
        console.log("Rejoined user");
    }

in lib/eventHandler.js. Note that they will still be listed in bot.getUsers(), but the userJoin event gets triggered again at least.

Edit: In an update the userLeave event gets triggered again now and then, depending on how the user closes the site.