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

Function deleteLotteryActivity

lottery/lottery.ts:298–323  ·  view source on GitHub ↗
(lotteryId: number)

Source from the content-addressed store, hash-verified

296 // Delete participants
297 const deleteParticipants = db.prepare(`DELETE FROM lottery_participants WHERE lottery_id = ?`);
298 deleteParticipants.run(lotteryId);
299
300 // Delete winners
301 const deleteWinners = db.prepare(`DELETE FROM lottery_winners WHERE lottery_id = ?`);
302 deleteWinners.run(lotteryId);
303
304 // Delete lottery config
305 const deleteLottery = db.prepare(`DELETE FROM lottery_config WHERE id = ?`);
306 deleteLottery.run(lotteryId);
307 });
308
309 transaction();
310 return true;
311 } catch (error) {
312 console.error("Failed to delete lottery activity:", error);
313 return false;
314 }
315}
316
317// Enhanced lottery management functions
318function createLotteryConfig(config: any): number {
319 if (!db) return 0;
320
321 const stmt = db.prepare(`
322 INSERT INTO lottery_config (
323 chat_id, title, keyword, max_participants, winner_count, mode,
324 distribution_mode, claim_timeout, delete_delay, require_avatar,
325 require_username, required_channel, prize_warehouse, allow_bots,
326 member_filter, auto_draw_time, created_at, creator_id, unique_id

Callers 1

lotteryFunction · 0.85

Calls 2

runMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected