2020-09-07 17:35:37 +01:00
|
|
|
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) {
|
2022-01-04 03:39:53 +00:00
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
2020-08-27 13:09:35 +01:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
let userIds = [];
|
2020-08-27 13:09:35 +01:00
|
|
|
|
2022-02-23 05:35:10 +00:00
|
|
|
for (let user of global.users.getIterableItems()) {
|
|
|
|
userIds.push(user.id);
|
2022-01-04 03:39:53 +00:00
|
|
|
}
|
2020-08-27 13:09:35 +01:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
osuPacketWriter.UserPresenceBundle(userIds);
|
2020-08-27 13:09:35 +01:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
if (sendImmidiate) currentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
else return osuPacketWriter.toBuffer;
|
2020-08-27 13:09:35 +01:00
|
|
|
}
|