Highrise SDK
A JavaScript library for creating and managing Highrise bots.
Description
The Highrise SDK provides a comprehensive set of tools and functions to interact with the Highrise game platform. It allows developers to create bots that can perform various actions within the Highrise environment, such as sending messages, managing user interactions, handling in-game economy, and more.
Installation
To install the Highrise SDK, use npm:
npm install hr-sdk
Usage
Here's a basic example of how to use the Highrise SDK:
import { HR, Event } from 'hr-sdk';
const bot = new HR();
bot.on(Event.Ready, (data) => {
console.log("bot is connected to the server", data)
})
bot.on(Event.Chat, ({user, message, whisper}) => {
console.log('Received chat create event: @' + user.username + ": " + message);
});
bot.connect('YOUR_BOT_TOKEN', 'YOUR_ROOM_ID');
Actions return promises
Actions without a result (broadcastMessage, whisper, emote, walk, teleport, modAction, ...)
return a Promise<void> that resolves when Highrise accepts the request and rejects with its error:
try {
await bot.action.emote({ emoteId: 'emote-wave' });
} catch (error) {
console.error('Highrise rejected the emote:', error.message);
}
Calling them without await is still safe: the promise never becomes an unhandled rejection, and
server errors are also emitted as an Event.Error event. Invalid payloads and a closed socket still
throw synchronously.
Connection events
Event.Ready: session started (also after every reconnect)Event.Disconnected,Event.Reconnecting({ attempt, delay }),Event.ReconnectFailedEvent.Stopped({ reason }): Highrise refused the session and asked not to reconnect (e.g. invalid token)
The SDK reconnects by itself with backoff and detects silent dead connections (no data for 35s).
Features
The Highrise SDK supports the following functions:
Chat and Communication
message: Send a chat messagewhisper: Send a private message to a useremote: Perform an emote actionreaction: Send a reactionsetIndicator: Show an icon over the bot (nullclears it)
User Management
getRoomUsers: Get a list of users in the current roomgetRoomUserByUsername: Find a user in the room by usernamegetRoomUserByUserId: Find a user in the room by user IDmoveUserToRoom: Move a user to another room
Room Interactions
sit: Make the bot sit on a specific anchorwalk: Make the bot walk to a specific positionteleport: Teleport the bot to a specific position
Economy and Transactions
getWallet: Get the bot's wallet informationgetGold: Get the bot's gold balancegetBoostToken: Get the bot's boost token balancegetVoiceToken: Get the bot's voice token balancetipUser: Send a tip to a userbuyVoice: Purchase voice timebuyBoost: Purchase a room boostbuyItem: Purchase an item from the shop
Moderation and Privileges
modAction: Perform a moderation actiongetRoomPrivilege: Get a user's room privilegeschangeRoomPrivilege: Change a user's room privileges
Inventory and Outfits
getBackpack: Get a user's backpack contentschangeBackpack: Add or remove items in a user's backpackgetOutfit: Get a user's current outfitgetMyOutfit: Get the bot's own outfitsetOutfit: Set the bot's outfitgetInventory: Get the bot's inventory
Voice Chat
getVoiceStatus: Voice chat time left, default speakers and each user's statusinviteSpeaker: Invite a user to speakremoveSpeaker: Remove a user from speaking
Messaging System
getConversation: Get conversation historysendMessage: Send a message in a conversationsendBulkMessage: Send a message to multiple conversationsgetMessage: Get a specific messageleaveConversation: Leave a conversation
Miscellaneous
channel: Send a hidden channel message to other botsuploadMedia: Upload an image/gif for a media direct message
Events
Chat,Emote,Reaction,PlayerJoin,PlayerLeft,PlayerMovement,Tip,Channel,Voice,Message,Moderate,Error
Web API (
import { webApi } from 'hr-sdk', no token needed)getUserById,getUserByUsername,getUsersgetRoomById,getRoomsgetPost,getPostsgetItem,getItemsgetGrab,getGrabs
List calls take
{ startsAfter, endsBefore, sortOrder, limit }plus their filters and return{ <records>, total, firstId, lastId }.
Documentation
For detailed documentation on each function and its parameters, please refer to our API Documentation.
Contributing
We welcome contributions to the Highrise SDK! Please mail Email for more information on how to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.