2021-01-26 12:26:46 +00:00
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
module.exports = function(CurrentUser, channelName = "") {
|
|
|
|
// Make sure the user is not already in the channel
|
2021-02-01 03:01:37 +00:00
|
|
|
if (global.StreamsHandler.isUserInStream(channelName, CurrentUser.uuid))
|
2021-01-26 12:26:46 +00:00
|
|
|
return global.consoleHelper.printBancho(`Did not add user to channel ${channelName} because they are already in it`);
|
|
|
|
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
osuPacketWriter.ChannelJoinSuccess(channelName);
|
2021-02-01 03:01:37 +00:00
|
|
|
if (!global.StreamsHandler.isUserInStream(channelName, CurrentUser.uuid))
|
|
|
|
global.StreamsHandler.addUserToStream(channelName, CurrentUser.uuid);
|
2021-01-26 12:26:46 +00:00
|
|
|
|
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|