(lotteryId: number)
| 412 | LEFT JOIN lottery_participants p ON w.user_id = p.user_id AND w.lottery_id = p.lottery_id |
| 413 | WHERE w.lottery_id = ? |
| 414 | ORDER BY w.assigned_at |
| 415 | `); |
| 416 | return stmt.all(lotteryId); |
| 417 | } |
| 418 | |
| 419 | // User validation functions |
| 420 | async function validateUserConditions(client: TelegramClient, user: any, lottery: any, chatId: string): Promise<{ valid: boolean; reason?: string }> { |
| 421 | try { |
| 422 | // Check if user is a bot |
| 423 | if (!lottery.allow_bots && user.bot) { |
| 424 | return { valid: false, reason: "机器人不允许参与抽奖" }; |
| 425 | } |
| 426 | |
| 427 | // Check avatar requirement |
| 428 | if (lottery.require_avatar) { |
no outgoing calls
no test coverage detected