The method invite.send()
is used to send an invite to a specific user. It requires two parameters: the user ID of the recipient and the room ID to which the user is invited.
// Assuming you have defined the Highrise instance as "bot".
bot.on("messageCreate", (user_id, data, message) => {
if (message === "invite") {
bot.invite.send(user_id, bot.auth.room.id).catch(e => console.error(e));
}
});
Note: ****In order to receive messages, AutoFetchMessages
should be enabled in the Highrise configuration. Here's an example of how to enable AutoFetchMessages
:
const bot = new Highrise({
Events: [
Events.DirectMessages // Listen for direct messages.
],
AutoFetchMessages: true, // Fetches messages on direct message events.
});
Go Back: Sending Messages