Skip to content

SteamBadgeUnlocker

HenkerX64 edited this page Mar 6, 2022 · 5 revisions

node-steam-badge-unlocker is a lib extension with multiple classes for simple usage. This page lists all methods and properties available from the root of the module.

At first, you need an instance of node-steamcommunity. Example:

const SteamCommunity = require('steamcommunity');
let community = new SteamCommunity();

Then you can create new instance of node-steam-badge-unlocker. Example:

const SteamBadgeUnlocker = require('steam-badge-unlocker');
let badgeUnlocker = new SteamBadgeUnlocker(community);

Properties

No public properties defined at the moment.

Constructor(community[, options])

  • community - Required. An object of node-steamcommunity instance with logged in user.

    SteamCommunity instance will be used for communication with steam platform.

  • options - Optional. An object with possible properties:
    • apiKey - steam web api key, in case if you already fetched api key, you can save the request and define it as property.
    • apiToken - steam web api token from points shop. In case if you already fetched api token, you can save the request.
    • customUrl - customUrl from profile. For better quality of request based on profile url, you can predefine it here.

Classes

createCommunityLeader(options)

: CCommunityLeader Returns CCommunityLeader instance.

  • options - <Object> - Required. See CCommunityLeader.options.

Default Getters

getCommunity()

: SteamCommunity Returns a community instance.

It will be used from extended methods to access SteamCommunity functions.

getLanguage()

: string Returns a used language. Default is english.

It is important to use english, because most of parsers are using english textes to analyse the response results.

getProfileUrl()

: string Returns a link to logged in steam profile. Default is https://steamcommunity.com/profiles/{steamId}

Will be used to call profile based urls.

getSessionId()

: string Returns steamcommunity web session id.

SteamCommunity normally copy same cookies to api, community and store pages. One session id should be enough for all requests.

getSteamId()

: string Returns steam id.

SteamCommunity.steamID will be copied as string and saved as internal static variable, that will be used with this method.

getWebApiKey()

: Promise<string> Returns steam api key if possible. It is empty string for limited accounts.

This is one time request if api key is not defined with constructor options. The response will be cached and used for second calls.

getWebApiToken()

: Promise<string> Returns steam api token. Promise will be rejected on failure.

This is one time request if api token is not defined with constructor options. The response will be cached and used for second calls.


Request Methods

get(options)

: Promise<string | json> Returns html result or json object in case of json: true. Promise will be rejected on http or steam errors.

  • options - request module options.
    • url - string - Required. Fully qualified url for requests.
    • json - boolean. Returns json object on true or html string on false.
    • qs - Object. Get parameters for url.
    • headers - Object. Headers.

Examples:

// lets check new inventory items
badgeUnlocker.get({
  url: 'https://steamcommunity.com/actions/GetNotificationCounts',
  json: true,
}).then(json => {

  if (json && json.notifications) {
     console.log('New items:', json.notifications['5']);
  } else {
     console.log('New items:', null);
  }

}, error => console.log(error));
// or you have async function:
const json = await badgeUnlocker.get({
  url: 'https://steamcommunity.com/actions/GetNotificationCounts',
  json: true,
}).catch(() => {});

if (json && json.notifications) {
     console.log('New trade offers:', json.notifications['1']);
     console.log('New invites:', json.notifications['6']);
}

post(options)

: Promise<string | json> Returns html result or json object in case of json: true. Promise will be rejected on http or steam errors.

  • options - request module options.
    • url - <string> - Required. Fully qualified url for requests.
    • json - <boolean>. Returns json object on true or html string on false.
    • qs - <Object>. Get parameters for url.
    • headers - <Object>. Headers.
    • form - <Object>. Post parameters.
    • followRedirect - <boolean>. Follow non-GET HTTP redirects.
    • followOriginalHttpMethod - <boolean>. Follow redirects its original HTTP method.

Examples:

// lets unsubscribe from all steam emails
badgeUnlocker.post({
  url: 'https://store.steampowered.com/account/emailoptout',
  form: {
     action: 'save',
     sessionid: badgeUnlocker.getSessionId(),
     opt_out_all: 1,
  },
  followAllRedirects: true,
}).then(() => console.log('done'), error => console.log(error));
// or you have async function:
// lets subscribe only to wishlist sales
await badgeUnlocker.post({
  url: 'https://store.steampowered.com/account/emailoptout',
  form: {
     action: 'save',
     sessionid: badgeUnlocker.getSessionId(),
     opt_out_all: 0,
     opt_out_wishlist_inverse: 1,
  },
  followAllRedirects: true,
}).catch(error => console.log(error));

Methods

finishDiscoveryQueue()

: Promise<Array<html>> Create new discovery queue and clear for all game ids automatically.

Examples:

badgeUnlocker.finishDiscoveryQueue().then(() => console.log('discovery queue done'), e => console.log(e));

clearDiscoveryQueueAppId(appId[, queueAppId])

: Promise<html> Clear discovery queue for single app id.

  • appId - <number> - Required. Game id.
  • queueAppId - <number>. Default: 10. App id for clearing requests.

generateNewDiscoveryQueue([eQueueType])

: Promise<{queue: Array<number>}> Generate new discovery queue of 11 games.

  • eQueueType - <number>. Default: 0. Unknown queue type.

getAllContentHome(subSection[, params])

: Promise<html> Returns short html content of last 10 entries for specific sub section.

  • subSection - <string> - Required. Possible values see in ESubSection.
  • params - <{qs: Object, headers: Object}>.
    • qs: Get query parameters like: p for page number or browsefilter.
    • headers: are headers object.

getCommunityBadgeProgress(apiKey[, badgeId])

: Promise<{response: {quests?: Array<{questid: number, completed: boolean}>}>

Gets all the quests needed to get the specified badge, and which are completed.

  • apiKey - <string> - Required.
  • badgeId - <number>. Default: 2 - Steam Community Badge.

getCommunityBadgeProgressFromProfile([badgeId])

: Promise<{response: {quests?: Array<{questid: number, completed: boolean}>}>

Gets all the quests needed to get the specified badge, and which are completed.

  • badgeId - <number>. Default: 2 - Steam Community Badge.

This option works only for mapped badges. At the moment it is only Steam Community Badge with id: 2.

setFavoriteBadge(badgeId[, isCommunityItem])

craftBadge(appId[, borderColor[, levels]])

getAppIdsReadyForCrafting([levels])

getBroadcastManifest(steamId)

getBroadcastTrendLinks([params])

discussionsSearch(query)

discussionsGameForumSearch(query[, listType]) - deprecated

getGuidesTrendLinks([params])

selectAvatar(appId[, selectedAvatar])

setProfileBackground(itemId)

getOwnedProfileItems()

logFriendActivityUpvote()

getUserNews([start])

getLastFriendPosts([minPosts])

voteContent(params)

addGameRecommendation(appId, comment[, rateUp])

deleteGameRecommendation(appId)

subscribeToSharedFile(fileId, appId)

unsubscribeFromSharedFile(fileId, appId)

getSharedFileDetails(fileId[, params])

voteSharedFile(fileId[, up])

deleteSharedFile(fileId[, appId[, fileType]])

postSharedFileComment(steamId, fileId, comment[, count])

deleteSharedFileComment(steamId, fileId, commentId[, count])

getProfileVideos([params])

fetchYoutubeVideos()

postYoutubeVideo(youtubeIds[, appId[, otherAssoc]])

setYoutubeCookies(cookies)

makeNavCookie(snr, url)

modifyWishlist(navRef, appId, remove)

addToWishlist(appId[, navRef])

removeFromWishlist(appId[, navRef])

getWorkshopTrendLinks([params])

uploadScreenshot(appId, title, description, file)

Clone this wiki locally