UNPKG

nobloxmmc.js

Version:

A Node.js wrapper for ROBLOX. (original from sentanos)

44 lines (39 loc) 1.14 kB
const http = require('../util/http.js').func const getGeneralToken = require('../util/getGeneralToken.js').func exports.required = ['height', 'width', 'head'] exports.optional = ['depth', 'proportion', 'bodyType', 'jar'] const nextFunction = (jar, token, height, width, head, depth, proportion, bodyType) => { return http({ url: '//avatar.roblox.com/v1/avatar/set-scales', options: { method: 'POST', jar: jar, headers: { 'X-CSRF-TOKEN': token }, json: { height: height, width: width, head: head, depth: depth, proportion: proportion, bodyType: bodyType }, resolveWithFullResponse: true } }).then((res) => { if (res.statusCode === 200) { if (!res.body.success) { throw new Error(res.body) } } else { throw new Error('Set avatar scale failed') } }) } exports.func = (args) => { const jar = args.jar return getGeneralToken({ jar: jar }).then((xcsrf) => { return nextFunction(jar, xcsrf, args.height, args.width, args.head, args.depth, args.proportion, args.bodyType) }) }