2022-11-19 01:06:03 +00:00
|
|
|
import { User } from "../objects/User";
|
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
export function UserPresenceBundle(user:User, sendImmidiate:boolean = true) {
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
let userIds:Array<number> = new Array<number>();
|
|
|
|
|
2022-11-19 22:28:46 +00:00
|
|
|
for (let userData of user.sharedContent.users.getIterableItems()) {
|
2022-11-19 01:06:03 +00:00
|
|
|
userIds.push(userData.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
osuPacketWriter.UserPresenceBundle(userIds);
|
|
|
|
|
|
|
|
if (sendImmidiate) user.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
else return osuPacketWriter.toBuffer;
|
|
|
|
}
|