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

Function createLotteryConfig

lottery/lottery.ts:326–348  ·  view source on GitHub ↗
(config: any)

Source from the content-addressed store, hash-verified

324 chat_id, title, keyword, max_participants, winner_count, mode,
325 distribution_mode, claim_timeout, delete_delay, require_avatar,
326 require_username, required_channel, prize_warehouse, allow_bots,
327 member_filter, auto_draw_time, created_at, creator_id, unique_id
328 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
329 `);
330
331 const result = stmt.run(
332 config.chat_id, config.title, config.keyword, config.max_participants,
333 config.winner_count, config.mode, config.distribution_mode, config.claim_timeout,
334 config.delete_delay, config.require_avatar ? 1 : 0, config.require_username ? 1 : 0,
335 config.required_channel || null, config.prize_warehouse || 'default', config.allow_bots ? 1 : 0,
336 config.member_filter || null, config.auto_draw_time || null, Date.now(), config.creator_id,
337 config.unique_id
338 );
339
340 return result.lastInsertRowid as number;
341}
342
343function getActiveLottery(chatId: string): any | null {
344 if (!db) return null;
345
346 const stmt = db.prepare(`
347 SELECT * FROM lottery_config
348 WHERE chat_id = ? AND status = 'active'
349 ORDER BY created_at DESC LIMIT 1
350 `);
351 return stmt.get(chatId) as any;

Callers 1

lotteryFunction · 0.85

Calls 1

runMethod · 0.80

Tested by

no test coverage detected