Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle itemconfiguration error codes 37 and 40 #839

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions lib/develop/configureItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,65 @@ function configureRobux (args) {
} else if (json.errors[0].code === 20) { // "Cannot set the associated asset type to remove-from-release" - caused by copyable asset using sellForRobux: 0
// Continue and ignore the error as the intended outcome makes the asset private; set sellForRobux from 0 to false
return configure(args.jar, args.token, args.id, args.name, args.description, args.enableComments, args.sellForRobux, args.genreSelection, !!args.sellForRobux)
} else if (json.errors[0].code === 37) { // "AssetIsLimited" - Use the newer endpoint to update price and sale status
return http({
url: '//catalog.roblox.com/v1/catalog/items/details',
options: {
method: 'POST',
jar: args.jar,
json: {
items: [
{
id: args.id,
itemType: 1
}
]
},
resolveWithFullResponse: true
}
}).then((response) => {
if (!response.ok) throw new Error(response.body)

const { collectibleItemId, price } = JSON.parse(response.body)

if (!collectibleItemId) throw new Error(`The publishing fee for asset ${args.id} has not been paid, you must do this in order to change or set the price.`)

return http({
url: `//itemconfiguration.roblox.com/v1/collectibles/${collectibleItemId}`,
options: {
method: 'PATCH',
jar: args.jar,
headers: {
'X-CSRF-Token': args.token
},
json: {
isFree: false,
priceInRobux: args.sellForRobux || price,
priceOffset: 0,
quantityLimitPerUser: 0,
resaleRestriction: 2,
saleLocationConfiguration: {
places: [],
saleLocationType: 1
},
saleStatus: args.sellForRobux > 0 ? 0 : 1
},
resolveWithFullResponse: true
}
}).then((response) => {
if (!response.ok) throw new Error(response.body)

return {
name: args.name,
assetId: args.id,
description: args.description,
price: args.sellForRobux,
isCopyingAllowed: null
}
})
})
} else if (json.errors[0].code === 40) { // "Use collecibles publishing endpoint." - Publishing fee has not been paid for this asset
throw new Error(`The publishing fee for asset ${args.id} has not been paid, you must pay the fee before setting or updating the price.`)
}
throw new Error(`An unknown error occurred: [${json.errors[0].code}] ${json.errors[0].message}`)
}
Expand Down
Loading