Kicking a Player:
The method
player.kick() is used to kick a player from the room. It requires one parameter: the user ID of the player to kick.Note: The bot can only perform this action if it is owned by the room owner or if it has the required permissions to perform the action in the room. The bot cannot perform moderator actions on players who have moderator privileges.
// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { const user_id = "change-me"; if (message === "kick") { bot.player.kick(user_id).catch(e => console.error(e)); } });
Muting a Player:
The method
player.mute() is used to mute a player for a specified duration. It requires two parameters: the user ID of the player to mute, and the duration of the mute in seconds.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { const user_id = "change-me"; if (message === "mute") { bot.player.mute(user_id, 60).catch(e => console.error(e)); } });
Unmuting a Player:
The method
player.unmute() is used to unmute a player.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { const user_id = "change-me"; if (message === "unmute") { bot.player.unmute(user_id).catch(e => console.error(e)); } });
Banning a Player:
The method
player.ban() is used to ban a player for a specified duration. It requires two parameters: the user ID of the player to ban, and the duration of the ban in seconds.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { const user_id = "change-me"; if (message === "ban") { bot.player.ban(user_id, 3200).catch(e => console.error(e)); } });
Unbanning a Player:
The method
player.unban() is used to unban a player.// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { const user_id = "change-me"; if (message === "unban") { bot.player.unban(user_id).catch(e => console.error(e)); } });
In these examples, if there is an error performing any of the actions, it should log the error and refrain from executing the method. Additionally, the bot's ability to perform moderator actions is limited by its ownership status and permissions in the room.
Go Back: Perform Actions On Player