giveInventory

From SmartBots Developers Docs
Bot PlaygroundCommands
Revision as of 15:58, 1 July 2016 by Phil (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Commands bot to send an inventory item or folder to specific avatar.

Bot.giveInventory(avatar, object);

Reference

This command accepts the following parameters:

Variable Required Description


giveInventory:
avatar yes The avatar UUID.
object yes The inventory or folder UUID of the item. Use the Personal Bot Control Panel to get this UUID.
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed

Error messages

Bot checks the permissions of the item before doing the delivery. The following error message is being returned if object is no-trans:

transfer permission not set

This does not apply for folders. Empty folder is being delivered if no transferable items found.

Comments

  1. The inventory is loading each time your bot restarts. Allow about 60 seconds for inventory to completely load.
  2. Bot automatically recognizes the inventory folders and delivers them accordingly.
  3. The commands freezes for about 15 seconds if object UUID is not exists in bot's inventory. To avoid this make sure you are using correct UUIDs.

Examples

Bot.giveInventory(avatar, object)
.then(function(result) {
  if(result.success) {
    console.log("The inventory item was send.");
  } else {
    console.log("Error executing giveInventory: " + result.error);
  }
});