Skip to content

Asset Functions

lordhammyrblx edited this page Feb 7, 2019 · 1 revision

Asset Functions - noblox.js Wiki


buy

asset/product[, price, jar]

Buys asset asset with price restrictions. This can be a single value or an object with high and low that sets the respective price limits (both inclusive). This allows you to buy assets with a minimum or maximum amount of robux that can be used or a single required value and therefore guarantees you can't be scammed by a sudden price change. If a price restriction is not set, the asset will be bought for however much it costs (works with free assets). You are able to use product instead of asset, the options in product are collected automatically if not provided.

Arguments

  • either asset (number)
  • or product (Object)
    • ProductId (number)
    • Creator (Object)
      • Id (number)
    • PriceInRobux (number)
    • optional UserAssetId (number)
  • optional price (number/object)
    • high (number)
    • low (number)
  • optional jar (CookieJar)

Returns

(Promise)

  • (Object)
    • productId (number)
    • price (number)

Back to Top


configureItem

id, name, description[, enableComments, sellForRobux, genreSelection, jar]

Configures an item (shirt, pants, decal, etc.) with the id id to have name and description. If enableComments is true comments will be allowed and if sellForRobux is set it will be put on sale for that amount of robux.

Arguments

  • id (number)
  • name (string),
  • description (string)
  • optional enableComments (boolean)
    • default false
  • optional sellForRobux (number)
    • default false (not for sale)
  • optional genreSelection (number)
    • default 1
  • optional jar (CookieJar)

Returns

(Promise)

Back to Top


uploadItem

name, assetType, file[, groupId, jar]

Uploads an image stored in file as an assetType with name. If groupId is specified it will be uploaded to that group. This is for uploading shirts, pants, or decals which have the assetTypes 11, 12, and 13, respectively. Returns the asset id of the new item.

You should pass in the file as a stream, here is an example for uploading a shirt:

var fs = require('fs');
rbx.uploadImage('Shirt', 11, fs.createReadStream('./Image.png'));

Arguments

  • name (string)
  • assetType (number)
  • file (string/Stream)
  • optional groupId (number)
  • optional jar (CookieJar)

Returns

(Promise)

  • id (number)

Back to Top


uploadModel

data[, itemOptions, asset, jar]

Uploads data to asset with itemOptions. If asset is empty a new asset will be created. Both the assetId as well as the assetVersionId are returned in a object. Note that itemOptions is required when creating a new asset. It is only optional when updating an old asset, which ignores itemOptions and only updates data.

If you want to upload a large file the best thing to do is pass in data as a stream:

var fs = require('fs');
rbx.uploadModel(fs.createReadStream('./model'), {name: 'Model'});

Arguments

  • data (string/Stream)
  • optional itemOptions (Object)
    • name (string)
    • optional description (string)
      • default ""
    • copyLocked (boolean)
      • default true
    • allowComments (boolean)
      • default true
    • optional groupId (number)
  • asset (number)
  • optional jar (CookieJar)

Returns

(Promise)

  • (Object)
    • AssetId (number)
    • AssetVersionId (number)

Back to Top


getProductInfo

asset

Gets info of asset and caches according to settings.

Arguments

  • asset (number)

Returns

(Promise)

  • info (Object)
    • { "AssetId":123456789, "ProductId":24870409, "Name":"Hat", "Description":"", "AssetTypeId":8, "Creator":{"Id":1,"Name":"ROBLOX"}, "IconImageAssetId":0, "Created":"2015-06-25T20:07:49.147Z", "Updated":"2015-07-11T20:07:51.863Z", "PriceInRobux":350, "PriceInTickets":null, "Sales":0, "IsNew":true, "IsForSale":true, "IsPublicDomain":false, "IsLimited":false, "IsLimitedUnique":false, "Remaining":null, "MinimumMembershipLevel":0, "ContentRatingTypeId":0 }

Back to Top


This wiki is currently outdated. It will be kept for reference purposes. It is highly recommended you visit https://noblox.js.org instead to see the latest documentation.

Clone this wiki locally