Binato/server/Packets/ChannelJoin.js

15 lines
678 B
JavaScript
Raw Normal View History

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
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);
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);
}