Add basic documentation for helper functions

This commit is contained in:
2025-04-12 19:18:58 +02:00
parent d9418a3224
commit 21c0c5db43
4 changed files with 26 additions and 6 deletions

View File

@@ -8,7 +8,9 @@ interface itemChangeResult {
count: number,
inv?: inventory
}
/** Check if the target user can use/lose item(s) and return the new inventory
* @param [amount=-1] If not specified, reduce count by one
* @param [preconfirmed=false] If it is confirmed that the change is allowed, update the inventory immediately */
export async function changeItemCount(user: HelixUser, item: string, amount = -1, preconfirmed = false): Promise<itemChangeResult> {
if (!ITEMS.includes(item)) return { result: false, reason: 'noexist', count: 0 }
let inv = await getInventory(user)