constStoreAPI=require('./utils/economy/storeAPI');// Add a custom itemawaitStoreAPI.addItem(guildId,{name:'VIP Role',category:'roles',price:50000,rewardType:'role',rewardData:{roleId:'123456789',roleDuration:null},emoji:'π'});// Get all items in a categoryconstpets=awaitStoreAPI.getItems(guildId,'pets');// Purchase an item for a userconstresult=awaitStoreAPI.purchaseItem(guildId,userId,itemId,client);if (result.success) {console.log(`Purchased: ${result.item.name}`);}
π¦ Methods Reference
addItem(guildId, itemData)
Add a new item to the store.
Parameters:
Parameter
Type
Required
Description
name
string
β
Display name of the item
description
string
β
Item description
category
string
β
Category: pets, roles, boosters, titles, items, special
price
number
β
Cost in coins
stock
number
β
Available stock (-1 = unlimited)
maxPerUser
number
β
Max purchases per user (-1 = unlimited)
enabled
boolean
β
Whether item is available (default: true)
rewardType
string
β
Type of reward (see Reward Types)
rewardData
object
β
Reward-specific data
requirements
object
β
{ level: number, prestige: number }
emoji
string
β
Display emoji (default: π)
color
string
β
Hex color (default: #5865F2)
featured
boolean
β
Show in featured section
sortOrder
number
β
Sort priority (lower = first)
removeItem(guildId, itemId)
Remove an item from the store.
updateItem(guildId, itemId, updates)
Update an existing item.
getItem(guildId, itemId)
Get a single item by ID.
getItems(guildId, category?)
Get all items, optionally filtered by category.
getCategories(guildId)
Get all categories that have items.
getFeaturedItems(guildId)
Get all featured items.
purchaseItem(guildId, userId, itemId, client)
Process a purchase. Handles balance deduction, requirements validation, stock management, and reward application.
Possible Errors:
Item not found
Item out of stock
User not found
Insufficient funds
Requires level X
Requires prestige X
Purchase limit reached
You already own this pet!
getUserPurchases(guildId, userId)
Get a user's purchase history.
π Reward Types
pet
Adds a pet to the user's collection.
role
Grants a Discord role to the user.
booster
Activates a temporary multiplier booster.
title
Unlocks a display title for the user.
item
Adds a generic item to user's inventory.
custom
For addon-handled rewards. The reward isn't automatically applied.