Solution for getting appOwnershipChached apps' name instead of appid. I got config.default_apps by using an empty Steam account to get the numerical list of apps each account has by default and on that line I compare that default list to the list of the fetched user account which might have some games and then filter to remove the default apps.
//get GAME LIST
client.on('appOwnershipCached', async() => {
try {
const appIDs = await client.getOwnedApps()
let gameList = appIDs.filter((game) => { // remove default apps from list
return !config.default_apps.includes(game)
})
const appDetails = await client.getProductInfo(gameList, [])
let appData = appDetails.apps
let arr = await Object.keys(appData).map(key => { // convert list to array
return appData[key]
})
let cleanGameList = []
await arr.forEach(app => { // push only app names into array
if (app.appinfo.common !== undefined) { // necessary only .common since .common.name gives TypeError
cleanGameList.push(app.appinfo.common.name)
}
})
log(cleanGameList)
} catch(err) {
log(err)
}
})
Well, I've been trying/searching different things for hours now without any sufficient results. I am trying to get the name of the app/game instead of the appid number via appOwnershipCached. I am actually trying to get the games in the users account instead of also apps and default apps that come with a Steam account. I managed to get the names with an npm package called appid, but it takes a while until it converts all of them since it's fetching it from Steam API, so unfortunately it's not an option and I've run out. So I have two questions: Is there a way to get an apps' name instead of appid? Is there a way to get only the games without apps and default apps? Edit: I actually managed to filter it to the point until I get only the games in my library. I basically filter default apps from the appOwnershipCached fetch of appIDs and then if the appID has a name, it puts it into the gameList array. But the problem is, some games seem not to have names, why is that? For example: Rocket League only has { appid: '252590', public_only: '1' } on .appinfo... OLD NOT WORKING
//get GAME LIST
client.on('appOwnershipCached', async() => {
try {
const appIDs = await client.getOwnedApps()
log(appIDs)
let gameList = appIDs.filter((game) => {
return !config.default_apps.includes(game)
})
log(gameList)
accountData.games = await gameList
// log("my games: " + accountData.games)
const appDetails = await client.getProductInfo(gameList, [])
// ROCKET LEAGUE TEST
const rl = await client.getProductInfo([252590], [])
log(rl.apps[252590].appinfo)
//
let appData = appDetails.apps
// log(appData)
let arr = await Object.keys(appData).map(key => {
return appData[key]
})
// log(arr)
let cleanGameList = []
await arr.forEach(app => {
if (app.appinfo.common.name != null) {
// log(app.appinfo.common.name)
console.log("list: ", cleanGameList)
return cleanGameList.push(app.appinfo.common.name)
}
})
} catch(err) {
log(err)
}
})