The method player.permissions.get() is used to retrieve the permissions of a player in the current room. It requires one parameter: the user ID of the player whose permissions you want to retrieve.

Note: The owner of the room may sometimes return moderator and designer as false for both.

// Assuming you have defined the Highrise instance as "bot".
bot.on("chatCreate", async (user, message) => {
  if (message === "permissions") {
    bot.player.permissions.get(user.id).then(permissions => {

      console.log("User Permissions: ", permissions);
      console.log("Is Moderator: ", permissions.moderator);
      console.log("Is Designer: ", permissions.designer);

    }).catch(e => { console.error(e) });
  }

});

The Highrise.sdk package handles errors directly within the methods themselves. Each method returns a promise, so when using .catch(), it will log any errors that occur. This feature is useful in scenarios such as when a player leaves the room or when there is an issue retrieving permissions. Here's an example demonstrating this:

// Assuming you have defined the Highrise instance as "bot".
bot.on("chatCreate", async (user, message) => {
  if (message === "permissions") {
    bot.player.permissions.get(user.id).catch(e => console.error(e));
  }

});

In this example, if there is an error retrieving the permissions, it should log the error and refrain from executing the method.


Go Back: Perform Actions On Player