Highrise JS Documentation

Highrise JS Documentation


Introduction

highrise.sdk is a powerful Node.js module that provides an easy way to interact with the Highrise API . It offers a more object-oriented approach compared to other Highrise SDK libraries, resulting in cleaner and more comprehensible code for your bot.
The main focuses of highrise.sdk are usability, consistency, and performance. It provides full coverage of the Highrise API and promptly incorporates new Highrise features as they become available.

Why Choose highrise.sdk?

highrise.sdk is a user-friendly package that offers a wide range of methods, including some that are not included in the API, such as a caching system, awaitMessages, and games.

Here are some reasons to consider using highrise.sdk:

  • Ease of use: It provides a straightforward and intuitive interface.
  • Beginner-friendly: Designed for newcomers to programming or API usage.
  • Auto-reconnect system: It automatically handles reconnection in case of any disruptions.
  • Node version support: It supports Node version 10 and above.
  • Flexibility and feature-rich: It offers a flexible and comprehensive set of features.
By choosing highrise.sdk, you can enjoy the benefits of its simplicity, beginner-friendliness, auto-reconnect functionality, wide Node version support, and its range of flexible and feature-rich capabilities.
 
💡
If you’re not familiar with JavaScript or programming in general and wishes to create your own Highrise Bot, I suggest that you first take a few weeks to study programming logics and how JavaScript works.

⚙️ Setup

🔧 Installing Node.js

To run any JavaScript application, you need to install Node.js. It is recommended to install the latest version of Node.js. The highrise.sdk can be run with Node.js version v≥12.0.0. To install it, please visit the official website and follow the installation guide provided.

🤖 Creating A Bot

API Token:

The API token works as an identifier for your bot. It is used to authenticate your bot with the Highrise backend and is required to connect to the API. Anyone with your API token will be able to connect to the API as your bot, so it is important to keep it secure. If you believe your API token has been compromised, you can generate a new one at any time.
  1. Go to https://create.highrise.game
  1. Log in with the user you intend to be the owner of your bot.
  1. Go to Dashboard, then Bots & API Keys, and create a new bot.
  1. Once a new bot has been created, you can click on the Three Dots and Generate API Key to generate a new bot API token.
💡
The API token is the identifier for your bot, and you will use this when connecting your bot.

Room ID:

The room ID works as the gateway to the Highrise world. It is used to identify which room your bot is deployed to and is required to connect to the API. To get the room ID follow the steps below.

Adding Your Bot to Your Room

  1. Go to https://create.highrise.game
  1. Log in with the user that owns the bot you want to add to your room.
  1. Go to Dashboard, then Creations.
  1. Click on the Three Dots and Copy Room ID to copy the room ID of the room you want to add your bot to.

Adding Your Bot to a Room You Don't Own

  1. Visit the room in the Highrise App.
  1. Navigate to the room info panel on the top right corner and select "Share this Room".
  1. This will generate a link that contains the ID of the room.
  1. Extract the room ID from the link and use it in your API/SDK calls.
💡
Adding your bot to a room that you don't own will require designer rights to the room.

Permissions:

If you own the bot and the room, you won't need designer rights to add your bot to the room. However, if you don't own the room and want to add your bot to it, you will need either designer rights or to have your bot assigned to the room by the owner. This can be done by the owner of the room by going to the Creation Tab in the dashboard, clicking on the Three Dots and Assign Bot.

🔧 Installing The Package

To install the package, navigate to the folder you created. After running npm init -y inside your bot folder, you can proceed with the following command:
npm install highrise.sdk@latest
npm install highrise.sdk@latest

📥 Class Import

// This is a simple example of how to use the Highrise SDK to create a bot. const { Highrise, Events } = require("highrise.sdk"); // Change the token and room to your own. const token = "change-me"; const room = "change-me"; // Create a new instance of the Highrise class. const bot = new Highrise({ Events: [ Events.Messages, Events.Joins, Events.Leaves, Events.DirectMessages ], AutoFetchMessages: true, // Fetches messages on direct message events. Cache: true // Caches players in the room. }); // Listen for the ready event. bot.on('ready', (session) => { console.log(`Bot is now online in ${session.room_info.room_name}.`.cyan); }); // Listen for chatCreate events. bot.on("chatCreate", (user, message) => { console.log(`[CHAT]: ${user.username}:${user.id} - ${message}`); }); // Listen for directMessage events. bot.on("messageCreate", (user_id, data, message) => { console.log(`[DIRECT MESSAGE]: ${user_id}:${data.id} - ${message}`); }); // Listen for playerJoin events. bot.on('playerJoin', (user) => { console.log(`[PLAYER JOINED]: ${user.username}:${user.id}`); }); // Listen for playerLeave events. bot.on('playerLeave', (user) => { console.log(`[PLAYER LEFT]: ${user.username}:${user.id}`); }); // Listen for unhandledRejection events. // This is useful for catching errors that are not handled. process.on('unhandledRejection', async (err, promise) => { console.error(`[ANTI-CRASH] Unhandled Rejection: ${err}`.red); console.error(promise); }); // Login to the room. bot.login(token, room);

⏯️ Starting The Bot

💡
Head to your folder where the main file is located for example MyBot/app.js and run node .

Built with Potion.so