This event logs player objects when they join, including their username and user ID. It also logs the player's position. Typically, we use this event to send a welcome message when players join, either as a whisper or in the room.
const { Highrise, Events } = require("highrise.sdk");
// Create a new instance of the Highrise class.
const bot = new Highrise({
Events: [
Events.Joins, // Listen for player joins.
]
});
bot.on('playerJoin', (user, position) => {
console.log(`[PLAYER JOINED]: ${user.username}:${user.id} - ${position}`);
// Send a welcome message to the user.
bot.message.send(`Welcome to the room, ${user.username}!`);
});
Go Back: Get Methods