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

Function createPrizeWarehouse

lottery/lottery.ts:150–170  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

148 SELECT warehouse_name FROM prize_warehouse
149 WHERE warehouse_name = ?
150 LIMIT 1
151 `).get(name);
152
153 if (existingWarehouse) {
154 return false; // Warehouse already exists
155 }
156
157 const stmt = db.prepare(`
158 INSERT INTO prize_warehouse (warehouse_name, prize_text, stock_count, order_index, created_at)
159 VALUES (?, '', 0, 0, ?)
160 `);
161 stmt.run(name, Date.now());
162 return true; // Successfully created
163}
164
165function addPrizeToWarehouse(warehouseName: string, prizeText: string, stock: number): void {
166 if (!db) return;
167
168 // Check if the same prize already exists in the warehouse
169 const existingPrize = db.prepare(`
170 SELECT id, stock_count FROM prize_warehouse
171 WHERE warehouse_name = ? AND prize_text = ?
172 `).get(warehouseName, prizeText) as any;
173

Callers 1

lotteryFunction · 0.85

Calls 2

runMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected