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

Callers 1

lotteryFunction · 0.85

Calls 2

runMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected