2022-11-19 01:06:03 +00:00
|
|
|
import { User } from "../objects/User";
|
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
export function UserPresence(user:User, id:number, sendImmidiate:boolean = true) {
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
2022-11-19 22:28:46 +00:00
|
|
|
const userData = user.sharedContent.users.getById(id);
|
2022-11-19 01:06:03 +00:00
|
|
|
|
|
|
|
if (userData == null) return;
|
|
|
|
|
|
|
|
osuPacketWriter.UserPresence({
|
|
|
|
userId: id,
|
|
|
|
username: userData.username,
|
|
|
|
timezone: 0,
|
|
|
|
countryId: userData.countryID,
|
|
|
|
permissions: 4,
|
|
|
|
longitude: userData.location.longitude,
|
|
|
|
latitude: userData.location.latitude,
|
|
|
|
rank: userData.rank
|
|
|
|
});
|
|
|
|
|
|
|
|
if (sendImmidiate) userData.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
else return osuPacketWriter.toBuffer;
|
|
|
|
}
|