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

Callers 1

distributePrizesFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected