The method player.react() is used to execute an reaction on a player, requiring two parameters: the user ID of the individual on whom you wish to perform the reaction, and the reaction ID.

Note: The bot can only perform an reaction on the target user and not the bot itself. We have included some reactions that can be accessed by importing the class "Reactions" from the package. For example:

const { Facing } = require("highrise.sdk");

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

The Highrise.sdk package is renowned for handling errors directly within the methods themselves. Each method returns a promise, so when using .catch(), it will log the error. This feature can be particularly useful in scenarios such as when a player leaves the room. Here's an example demonstrating this:

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

In this example, we use the reaction ID as "test," which is invalid. It should log an error and refrain from executing the method.


Go Back: Perform Actions On Player