Difference between revisions of "Bot Playground/Events/teleport offer"
From SmartBots Developers Docs
Line 1: | Line 1: | ||
{{DISPLAYTITLE:teleport_offer}} | {{DISPLAYTITLE:teleport_offer}} | ||
<onlyinclude>Fires when bot receives a teleport offer from another avatar.</onlyinclude> | <onlyinclude>Fires when bot receives a teleport offer from another avatar.</onlyinclude> | ||
+ | |||
+ | <syntaxhighlight lang="javascript"> | ||
+ | Bot.on("teleport_offer", function(event) { ... }); | ||
+ | </syntaxhighlight> | ||
{{API Event Table}} | {{API Event Table}} | ||
Line 12: | Line 16: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
Bot.on("teleport_offer", function(event) { | Bot.on("teleport_offer", function(event) { | ||
− | + | Bot.key2name(event.avatar_uuid) | |
− | + | .then(function(result) { | |
− | + | if(result.success) { | |
− | + | console.log("Got teleport offer from: " + result.slname); | |
− | + | } else { | |
− | + | console.log("Error executing key2name: " + result.error); | |
− | + | } | |
− | + | }); | |
}); | }); | ||
Revision as of 12:37, 1 July 2016
Fires when bot receives a teleport offer from another avatar.
Bot.on("teleport_offer", function(event) { ... });
Reference
This event comes with the following event object:
Variable | Required | Description | |
---|---|---|---|
Output: | |||
avatar_uuid | The UUID of the sender |
Example
Bot.on("teleport_offer", function(event) {
Bot.key2name(event.avatar_uuid)
.then(function(result) {
if(result.success) {
console.log("Got teleport offer from: " + result.slname);
} else {
console.log("Error executing key2name: " + result.error);
}
});
});
console.log("Bot is listening, teleport offers");