sentanos / roblox-js

!!!THIS PROJECT IS NO LONGER MAINTAINED!!! Execute ROBLOX website actions in node.js
MIT License
45 stars 45 forks source link

Item Info #39

Closed Conmmander closed 7 years ago

Conmmander commented 7 years ago

It would be nice if you could add the enhancement tag to this since I am just suggesting a feature and providing some code that works with it.

So I decided it would be cool if you could get item Information first, since you have the buy command, but what if you have no clue what you are buying and want to find out information on it. So I decided to add a JS file called getItemInfo. it grabs a ton of item info when used. This includes things like Who created it, the item description. Its price in robux, if it is a limited item and a whole lot more.

Here is the code.

// Includes var http = require('./http.js').func;

// Args exports.required = ['assetID'];

// Define exports.func = function (args) { var httpOpt = { url: '//api.roblox.com/Marketplace/ProductInfo?assetId=' + args.assetID, options: { resolveWithFullResponse: true, method: 'GET', followRedirect: false, jar: jar } }; return http(httpOpt) .then(function (res) { if (res.statusCode !== 200) { throw new Error('You are not logged in.'); } else { var json = JSON.parse(res.body); var result = (option ? json[option] : json); return result; } }); };

I put the JS file inside of lib/util and run it using

var ItemID = 1;

rbxlogin().then(function () { robloxjs.getItemInfo(ItemID).then(function (info) { console.log(info) }); });

I built this because I got really bored, and gave up attempting to build something to get the player's status.

sentanos commented 7 years ago

Actually getProductInfo already existed: https://github.com/sentanos/roblox-js/wiki/Utility-Functions#getproductinfo