Difference between revisions of "Bot Playground/Commands/acceptTeleportOffer"
From SmartBots Developers Docs
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Accept (or reject) a teleport offer sent by other avatar.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.on("teleport_off...") |
|||
Line 8: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | See [[Bot_Playground/Events/ | + | See [[Bot_Playground/Events/teleport_offer| teleport_offer]] event for details. |
Latest revision as of 08:20, 18 October 2022
Accept (or reject) a teleport offer sent by other avatar.
Bot.on("teleport_offer", (event) => {
Bot.acceptTeleportOffer(event.avatar_uuid, event.session_id, true);
});
See teleport_offer event for details.
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
avatar_uuid | yes | sender avatar UUID | |
session_id | yes | session UUID from the event | |
accept | yes | true to accept an offer, false to reject. | |
Output: | |||
Function returns a Promise with the following data: | |||
success | bool | true if command completed successfully | |
error | string | error string if command has failed |
Notes
- Bot cannot reject teleport offers from Bot Owner.
Example
Bot.on("teleport_offer", async function(event) {
console.log("Got teleport offer from: " + event.avatar_name + "\n\nAccepting now.");
let response = await Bot.acceptTeleportOffer(event.avatar_uuid, event.session_id, true);
if(response.success)
{
console.log("Accepted the Teleport Offer");
} else {
console.log("Rejected the Teleport Offer");
console.error("Error: " + response.error)
}
});
console.log("Bot is listening, teleport offers");
<< return back to Bot commands
(Miss an API call or parameter? Submit your request in forum)