Skip to content

Commit

Permalink
ok linting issues should now be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Campbell authored and Cameron Campbell committed Aug 14, 2024
1 parent d34451e commit 42a4bff
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/util/getCurrentUser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Includes
const http = require('./http.js').func
const { func:getPlayerThumbnail } = require("../thumbnails/getPlayerThumbnail.js")
const { func: getPlayerThumbnail } = require('../thumbnails/getPlayerThumbnail.js')

// Args
exports.optional = ['option', 'jar']
Expand All @@ -20,18 +20,18 @@ exports.optional = ['option', 'jar']
// Define
exports.func = async function ({ jar, option }) {
try {
const { body:userInfo } = await constructRequest(`//users.roblox.com/v1/users/authenticated`, jar)
const { body: userInfo } = await constructRequest('//users.roblox.com/v1/users/authenticated', jar)
const userId = userInfo.id

const [ thumbnailReq, robuxReq, premiumReq ] = await Promise.allSettled([
getPlayerThumbnail({ userIds: [ userId ], cropType: "Body" }),
constructRequest("//economy.roblox.com/v1/user/currency", jar),
constructRequest(`//premiumfeatures.roblox.com/v1/users/${userId}/validate-membership`, jar)
const [thumbnailReq, robuxReq, premiumReq] = await Promise.allSettled([
getPlayerThumbnail({ userIds: [userId], cropType: 'Body' }),
constructRequest('//economy.roblox.com/v1/user/currency', jar),
constructRequest('//premiumfeatures.roblox.com/v1/users/' + userId + '/validate-membership', jar)
])

const thumbnail = thumbnailReq.status == "fulfilled" && thumbnailReq.value[0].imageUrl
const robux = robuxReq.status == "fulfilled" && robuxReq.value.body.robux
const premium = premiumReq.status == "fulfilled" && premiumReq.value.body
const thumbnail = thumbnailReq.status === 'fulfilled' && thumbnailReq.value[0].imageUrl
const robux = robuxReq.status === 'fulfilled' && robuxReq.value.body.robux
const premium = premiumReq.status === 'fulfilled' && premiumReq.value.body

const json = {
UserID: userId,
Expand All @@ -48,11 +48,9 @@ exports.func = async function ({ jar, option }) {
return option.toLowerCase() === key.toLowerCase()
})[0]
return json[searchKey]

} catch (e) { throw Error("Could not get current user!", e) }
} catch (e) { throw Error('Could not get current user!', e) }
}


function constructRequest (url, jar) {
return http({
url: encodeURI(url),
Expand All @@ -63,4 +61,4 @@ function constructRequest (url, jar) {
jar
}
})
}
}

0 comments on commit 42a4bff

Please sign in to comment.