steam.workshop
The Steam Workshop API library.
Functions
async function steam.workshop.download(wsid: string, timeout: number): string
Downloads the item from the Steam Workshop.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
timeout | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string | file_path | The absolute path to the downloaded addon .gma. |
#steam.workshop.downloadIcon
async function steam.workshop.downloadIcon(wsid: string, uncompress?: boolean, timeout?: number): string
Downloads the icon of the Steam Workshop item and returns the absolute path to the file.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
uncompressoptional | boolean | Whether the icon should be uncompressed, true by default. |
timeoutoptional | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string | file_path | The absolute path to the icon file. |
#steam.workshop.fetchInfo
async function steam.workshop.fetchInfo(wsid: string, timeout?: number): steam.workshop.ItemInfo
Fetches a detailed information about a specific Steam Workshop item or collection.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the item/collection. |
timeoutoptional | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
steam.workshop.ItemInfo | info | The details of the item/collection. |
#steam.workshop.getCollectionDetails
async function steam.workshop.getCollectionDetails(ids: string[], id_count?: integer, timeout?: number): steam.workshop.Collection.Details[], integer
Returns the details of a Steam Workshop collection's.
Parameters
| Name | Type | Description |
|---|
ids | string[] | The Steam Workshop item ID's. |
id_countoptional | integer | The number of Steam Workshop item ID's. |
timeoutoptional | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
steam.workshop.Collection.Details[] | items | The details of the Steam Workshop collections. |
integer | item_count | The number of Steam Workshop collections. |
#steam.workshop.getItemDetails
async function steam.workshop.getItemDetails(ids: string[], id_count?: integer, timeout?: number): steam.workshop.Item.Details[], integer
Returns the details of a Steam Workshop item's.
Parameters
| Name | Type | Description |
|---|
ids | string[] | The Steam Workshop item ID's. |
id_countoptional | integer | The number of Steam Workshop item ID's. |
timeoutoptional | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
steam.workshop.Item.Details[] | items | The details of the Steam Workshop items. |
integer | item_count | The number of Steam Workshop items. |
#steam.workshop.getPublished
async function steam.workshop.getPublished(wtype: steam.workshop.Item.SearchType, wtags?: string[], woffset?: integer, timeout?: number): string[], integer, integer
Returns a list of publications published by the client.
Parameters
| Name | Type | Description |
|---|
wtype | steam.workshop.Item.SearchType | The type of the search. |
wtagsoptional | string[] | The tags of the search. |
woffsetoptional | integer | The offset of the search. |
timeoutoptional | number | The timeout in seconds of the search, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string[] | ids | The found publications IDs. |
integer | item_count | The length of the publications found array (#publications). |
integer | total | The total number of publications found. |
#steam.workshop.isAddonEnabled
function steam.workshop.isAddonEnabled(wsid: string): boolean
Returns whether the addon should be mounted on local server start-up.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
Returns
| Type | Name | Description |
|---|
boolean | | true if the addon is enabled, false otherwise. |
See also
#steam.workshop.isItemSubscribed
function steam.workshop.isItemSubscribed(wsid: string): boolean
Returns whether the publication is subscribed.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
Returns
| Type | Name | Description |
|---|
boolean | | true if client has subscribed to the item, false otherwise. |
See also
#steam.workshop.isValidID
function steam.workshop.isValidID(id?: string): boolean
Checks if the given Steam Workshop item ID is valid.
Parameters
| Name | Type | Description |
|---|
idoptional | string | |
Returns
| Type | Name | Description |
|---|
boolean | | |
#steam.workshop.markAsCompleted
function steam.workshop.markAsCompleted(wsid: string)
Marks the Steam Workshop item as completed.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
#steam.workshop.markAsPlayed
function steam.workshop.markAsPlayed(wsid: string)
Marks the Steam Workshop item as played.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
function steam.workshop.openPage(wsid: string)
Opens the page of the addon in the Steam Workshop.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
#steam.workshop.publishItem
async function steam.workshop.publishItem(filePath: string, imagePath: string, title: string, description?: string, tags: string[], changeLog?: string, timeout: number | nil | false): string
Publishes file to Steam Workshop.
Parameters
| Name | Type | Description |
|---|
filePath | string | The absolute path to the addon file. |
imagePath | string | The absolute path to the image file. |
title | string | The title of the addon. |
descriptionoptional | string | The description of the addon. |
tags | string[] | The tags for the addon. |
changeLogoptional | string | The changelog of the publication. |
timeout | number | nil | false | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string | workshop_id | The workshop ID of the published addon. |
#steam.workshop.qickSearch
async function steam.workshop.qickSearch(wtype: steam.workshop.Item.SearchType, wtags?: string[], woffset?: integer, timeout?: number): string[], integer, integer
Performs a quick search for publications.
Parameters
| Name | Type | Description |
|---|
wtype | steam.workshop.Item.SearchType | The type of the search. |
wtagsoptional | string[] | The tags of the search. |
woffsetoptional | integer | The offset of the search. |
timeoutoptional | number | The timeout in seconds of the search, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string[] | items | The found publications. |
integer | item_count | The length of the publications found array (#publications). |
integer | total | The total number of publications found. |
function steam.workshop.reload()
Refreshes local Steam Workshop addons.
This function should be called after changing the list of enabled addons.
See also
async function steam.workshop.search(params: steam.workshop.Item.SearchParams, timeout: number): string[], integer, integer
Performs a search for publications.
Parameters
| Name | Type | Description |
|---|
params | steam.workshop.Item.SearchParams | The search parameters. |
timeout | number | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
string[] | ids | The IDs of the found publications. |
integer | id_count | The length of the ids array (#ids). |
integer | total | The total number of found publications. |
#steam.workshop.setAddonEnabled
function steam.workshop.setAddonEnabled(wsid: string, enabled: boolean)
Sets whether the addon should be mounted on local server start-up.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
enabled | boolean | true to enable the addon, false to disable it. |
See also
#steam.workshop.setItemSubscribed
function steam.workshop.setItemSubscribed(wsid: string, subscribed: boolean)
Subscribes or unsubscribes the publication.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
subscribed | boolean | true to subscribe, false to unsubscribe. |
See also
#steam.workshop.updateItem
async function steam.workshop.updateItem(filePath: string, imagePath: string, title: string, description?: string, tags: string[], wsid: string, changeLog?: string, timeout: number | nil | false): boolean
Updates an file on Steam Workshop.
Parameters
| Name | Type | Description |
|---|
filePath | string | The absolute path to the addon file. |
imagePath | string | The absolute path to the image file. |
title | string | The title of the addon. |
descriptionoptional | string | The description of the addon. |
tags | string[] | The tags for the addon. |
wsid | string | The workshop ID of the addon. |
changeLogoptional | string | The changelog of the publication. |
timeout | number | nil | false | The timeout in seconds, if nil then the default timeout will be used. |
Returns
| Type | Name | Description |
|---|
boolean | success | true if the update was successful, false otherwise. |
function steam.workshop.vote(wsid: string, vote: boolean)
Votes for the Steam Workshop item.
Parameters
| Name | Type | Description |
|---|
wsid | string | The workshop ID of the addon. |
vote | boolean | true to vote for, false to vote against. |