acceptFriendshipOffer
Accept (or reject) a friendship offer sent by another avatar.
Bot.on("friendship_offer", (event) => {
Bot.acceptFriendshipOffer(event.avatar_uuid, event.session_id, true);
});See the friendship_offer event for details.
Input
Variable | Required | Description |
|---|---|---|
| yes | Sender avatar UUID |
| yes | Session UUID from the event |
| yes |
|
Output
Field | Type | Description |
|---|---|---|
| bool | true if command completed successfully |
| string | error string if command has failed |
Example
Bot.on("friendship_offer", async function(event) {
console.log("Got friendship offer from: " + event.avatar_name + "\n\nAccepting now.");
let response = await Bot.acceptFriendshipOffer(event.avatar_uuid, event.session_id, true);
if(response.success) {
console.log("Accepted the friendship Offer");
} else {
console.log("Rejected the friendship Offer");
console.error("Error: " + response.error);
}
});
console.log("Bot is listening, friendship offers");