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

Function getActiveLottery

lottery/lottery.ts:350–359  ·  view source on GitHub ↗
(chatId: string)

Source from the content-addressed store, hash-verified

348 ORDER BY created_at DESC LIMIT 1
349 `);
350 return stmt.get(chatId) as any;
351}
352
353function addParticipantToLottery(lotteryId: number, participant: any): boolean {
354 if (!db) return false;
355
356 try {
357 // Use transaction for concurrent safety
358 const transaction = db.transaction(() => {
359 // Check current participant count
360 const countStmt = db.prepare(`SELECT COUNT(*) as count FROM lottery_participants WHERE lottery_id = ?`);
361 const countResult = countStmt.get(lotteryId) as { count: number } | undefined;
362 const currentCount = countResult?.count || 0;

Callers 2

lotteryFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected