This event logs incoming messages in the room, providing user details like username and player ID, along with the message sent. It's the foundation for receiving messages and creating commands based on them.
<aside> 💡 Note: We advise informing players about chat logs for privacy and safety reasons. Some players may prefer not to have their chats saved or logged.
</aside>
const { Highrise, Events } = require("highrise.sdk");
// Create a new instance of the Highrise class.
const bot = new Highrise({
Events: [
Events.Messages // Listen for chat messages.
]
});
bot.on("chatCreate", (user, message) => {
// Log the chat message to the console.
console.log(`[CHAT]: ${user.username}:${user.id} - ${message}`)
// If the message is "dance", then dance.
if (message === "dance") {
bot.player.emote(user.id, "idle-dance-casual");
}
});
Go Back: Get Methods