UNPKG

goblox.js

Version:

Unoffical ROBLOX API wrapper made by Fastering18.

37 lines (35 loc) 1.4 kB
const requests = require("../util/baseRequest") const endpoints = require("../util/endpoints") function getStatus(id) { return new Promise((trima, tolak) => { new requests(`${endpoints.userinfo}/${id}/status`).json().get() .then((result) => { result = JSON.parse(result) if (result.errors) return result.errors; return trima(result) }).catch(err => { const body = { "usernames": [ nameOrid ], "excludeBannedUsers": false } const option = { body: JSON.stringify(body), } requests(endpoints.accountinfo, option).json().post() .then(async (resultName) => { resultName = JSON.parse(resultName); if (!resultName || !resultName.data || resultName.data.length <= 0) return tolak(`User not found`); const id = resultName.data[0].id return trima(await getStatus(id)) }).catch(err => { console.log(err) tolak(`User not found.`); }) }) }) } module.exports = { getStatus: getStatus }