Managing Voice Chat:
The method
room.voice.fetch() retrieves information about the current voice chat status in the room. It does not require any parameters.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "voice") { bot.room.voice.fetch().then(players => { console.log("Voice Chat Users: ", players); }).catch(e => { console.error(e) }); } });
Example output:
{ seconds_left: 3572, auto_speakers: [ '62cd82da462f6b0d3c1a9c45', '55bb64735531104341039ca8', ], users: { '55bb64735531104341039ca8': 'muted', '62cd82da462f6b0d3c1a9c45': 'voice' } }
Sub-Methods:
Active Users:
The
get.active() method retrieves the active users currently in the voice chat.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "active") { bot.room.voice.get.active().then(active => { active.forEach(async user => { const username = await bot.room.players.username(user); console.log("Voice Chat Active: ", username); }); }).catch(e => { console.error(e) }); } });
Auto Speakers:
The
get.auto_speakers() method retrieves users who are automatically enabled as speakers due to moderator or designer permissions.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "auto speakers") { bot.room.voice.get.auto_speakers().then(speakers => { console.log("Voice Chat Auto Speakers: ", speakers); }).catch(e => { console.error(e) }); } });
Muted Users:
The
get.muted() method retrieves users who are muted in the voice chat.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "muted") { bot.room.voice.get.muted().then(muted => { muted.forEach(async user => { const username = await bot.room.players.username(user); console.log("Voice Chat Muted: ", username); }); }).catch(e => { console.error(e) }); } });
Time Left:
The
get.seconds() method retrieves the remaining time in seconds for the voice chat session.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "time left") { bot.room.voice.get.seconds().then(seconds => { console.log("Voice Chat Seconds Left: ", seconds); }).catch(e => { console.error(e) }); } });
Go Back: Fetch Room Information