2020-08-27 13:09:35 +01:00
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
module.exports = function(CurrentUser) {
|
2020-11-03 02:08:57 +00:00
|
|
|
const logoutStartTime = new Date().getTime();
|
2020-08-27 13:09:35 +01:00
|
|
|
|
|
|
|
const streamList = global.StreamsHandler.getStreams();
|
|
|
|
|
|
|
|
for (let i = 0; i < streamList.length; i++) {
|
2021-02-01 03:01:37 +00:00
|
|
|
if (global.StreamsHandler.isUserInStream(streamList[i], CurrentUser.uuid)) {
|
|
|
|
global.StreamsHandler.removeUserFromStream(streamList[i], CurrentUser.uuid);
|
2020-08-27 13:09:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-15 00:24:39 +01:00
|
|
|
// Remove user from user list
|
|
|
|
global.removeUser(CurrentUser);
|
2020-08-27 13:09:35 +01:00
|
|
|
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
osuPacketWriter.SendMessage({
|
2021-05-15 00:24:39 +01:00
|
|
|
sendingClient: global.users["bot"].username,
|
2020-08-27 13:09:35 +01:00
|
|
|
message: `User ${CurrentUser.username} has logged out.`,
|
|
|
|
target: "#userlog",
|
2021-05-15 00:24:39 +01:00
|
|
|
senderId: global.users["bot"].id
|
2020-08-27 13:09:35 +01:00
|
|
|
});
|
|
|
|
global.StreamsHandler.sendToStream("#userlog", osuPacketWriter.toBuffer);
|
|
|
|
|
2020-11-03 02:08:57 +00:00
|
|
|
global.consoleHelper.printBancho(`User logged out, took ${new Date().getTime() - logoutStartTime}ms. [User: ${CurrentUser.username}]`);
|
2020-08-27 13:09:35 +01:00
|
|
|
}
|