UNPKG

goblox.js

Version:

Unoffical ROBLOX API wrapper made by Fastering18.

26 lines (23 loc) 1.03 kB
const requests = require("../util/baseRequest"); const endpoints = require("../util/endpoints") const { getUserFromId } = require("../util/validUser"); const devforum = {} // devforum only accept roblox name, you can specify it as number if you want to get from user id devforum.getUser = (name) => { return new Promise(async (terima, tolak) => { if (!name) return tolak("#1 devforum getUser require name as string"); const id = name if (typeof(name) == "number") { try { name = (await getUserFromId(name).catch(tolak)).name } catch (errr) { return tolak(errr) } } new requests(`${endpoints.devforumuserinfo}/${name.toLowerCase()}.json`).json().get().then(res => terima(JSON.parse(res))).catch(err => { if (err.error_type && err.error_type == "not_found") return tolak("User is not devforum member"); return tolak(err); }) }) } module.exports = devforum;