MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getNextAvailablePrize

Function getNextAvailablePrize

lottery/lottery.ts:255–265  ·  view source on GitHub ↗
(warehouseName: string)

Source from the content-addressed store, hash-verified

253 WHERE warehouse_name = ? AND stock_count > 0
254 ORDER BY order_index
255 LIMIT 1
256 `);
257 return stmt.get(warehouseName) || null;
258}
259
260function consumePrize(prizeId: number): boolean {
261 if (!db) return false;
262
263 const stmt = db.prepare(`
264 UPDATE prize_warehouse
265 SET stock_count = stock_count - 1
266 WHERE id = ? AND stock_count > 0
267 `);
268 const result = stmt.run(prizeId);

Callers 1

distributePrizesFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected