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

Function expireOldClaims

lottery/lottery.ts:513–523  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

511 WHERE status = ? AND expires_at < ?
512 `);
513 const result = stmt.run(PrizeStatus.EXPIRED, PrizeStatus.PENDING, Date.now());
514 return result.changes;
515}
516
517// Enhanced prize distribution
518async function distributePrizes(client: TelegramClient, lottery: any, winners: any[]): Promise<void> {
519 if (!db) return;
520
521 try {
522 // Use transaction for concurrent safety during prize distribution
523 const transaction = db.transaction(() => {
524 for (const winner of winners) {
525 // Get available prize from warehouse
526 const prize = getNextAvailablePrize(lottery.prize_warehouse || "default");

Callers 1

lotteryFunction · 0.85

Calls 1

runMethod · 0.80

Tested by

no test coverage detected