Binato/server/Packets/UserPresenceBundle.js

16 lines
413 B
JavaScript
Raw Normal View History

const osu = require("osu-packet");
2020-08-27 13:09:35 +01:00
2021-01-26 12:26:46 +00:00
module.exports = function(currentUser, sendImmidiate = true) {
const osuPacketWriter = new osu.Bancho.Writer;
2020-08-27 13:09:35 +01:00
let userIds = [];
2020-08-27 13:09:35 +01:00
for (let user of global.users.getIterableItems()) {
userIds.push(user.id);
}
2020-08-27 13:09:35 +01:00
osuPacketWriter.UserPresenceBundle(userIds);
2020-08-27 13:09:35 +01:00
if (sendImmidiate) currentUser.addActionToQueue(osuPacketWriter.toBuffer);
else return osuPacketWriter.toBuffer;
2020-08-27 13:09:35 +01:00
}