Commit Graph

15 Commits

Author SHA1 Message Date
Michilis
ff9c1f1dcf Remove keyboard buttons for users in groups when pressed 2025-12-20 02:38:56 +00:00
Michilis
83298dc4ca Update API client and notification scheduler services 2025-12-20 02:26:40 +00:00
Michilis
1dce27ea42 Filter out expired invoices from My Tickets view 2025-12-19 21:14:15 +00:00
Michilis
3bc067f691 feat: display truncated lightning address for winners
- Add truncateLightningAddress utility (shows first 2 chars + ******)
- Backend: Include winner_address in past-wins API response
- Frontend: Display truncated address in past winners list
- Telegram: Add truncated address to draw announcements for transparency

Example: username@blink.sv -> us******@blink.sv
2025-12-12 16:20:18 +00:00
Michilis
00f09236a3 feat(telegram): improve group handling and default display name to @username
- /lottosettings now opens settings in private DM instead of group
- Bot only reacts to / commands in groups (keyboard buttons ignored)
- Reply keyboard buttons removed from group messages
- Default display name now uses @username instead of 'Anon'
- Users can still manually update display name in settings
- Updated all display name usages to use centralized getDisplayName()
2025-12-12 15:28:05 +00:00
Michilis
959268e7c1 Improve startFirst error message for group users 2025-12-10 18:54:46 +00:00
Michilis
fb378d56c5 Fix draw notification spam and winning ticket number
- Group participants by telegramId to send only ONE message per user
- First pass finds the winning ticket info before sending any messages
- Loser messages now show the actual winning ticket number instead of #0000
- Unique participant count used for group announcements
2025-12-09 01:15:40 +00:00
Michilis
fcd180b7a4 Add 'Upcoming Jackpot' button to Telegram bot menu
Shows current prize pool, ticket price, draw time, and time remaining
2025-12-09 01:04:27 +00:00
Michilis
404fdf2610 Maintenance mode activates after current draw completes
- When admin enables maintenance, it's set to 'pending' state
- Maintenance activates automatically after the current draw completes
- Admin can use immediate=true to force immediate activation
- Frontend shows 'Maintenance Scheduled' banner when pending
- Telegram bot warns users but still allows purchases when pending
- Both mode and pending status tracked in system_settings table
2025-12-09 00:46:55 +00:00
Michilis
0eb8a6c580 Fix: Fetch fresh pot amount when sending draw reminders
Reminders now fetch current cycle data instead of using cached data
from when the reminder was scheduled, ensuring accurate pot amounts.
2025-12-09 00:20:36 +00:00
Michilis
d1ede9ee8d Fix: Add database migration for new_jackpot_delay_minutes column
Existing databases were missing the new column, causing SQLITE_ERROR
when updating group settings. Added migration logic to add missing columns.
2025-12-08 23:57:08 +00:00
Michilis
86e2e0a321 Fix reminder scheduling and add group features
- Fix reminder duplicate bug: use slot-only keys to prevent multiple reminders when settings change
- Add New Jackpot announcement delay setting for groups (default 5 min)
- Cancel unpaid purchases after draw completes (prevents payments for past rounds)
- Add BotFather commands template file
- Update README documentation
2025-12-08 23:49:54 +00:00
Michilis
13fd2b8989 Add SQLite database for Telegram bot user/group settings
- Replace Redis/in-memory storage with SQLite for persistence
- Add database.ts service with tables for users, groups, purchases, participants
- Update state.ts and groupState.ts to use SQLite backend
- Fix buyer_name to use display name instead of Telegram ID
- Remove legacy reminder array handlers (now using 3-slot system)
- Add better-sqlite3 dependency, remove ioredis
- Update env.example with BOT_DATABASE_PATH option
- Add data/ directory to .gitignore for database files
2025-12-08 22:33:40 +00:00
Michilis
918d3bc31e feat: Add configurable draw cycles, improve UX
Backend:
- Add configurable draw cycle settings (minutes/hourly/daily/weekly/custom)
- Add CYCLE_TYPE, CYCLE_INTERVAL_*, CYCLE_DAILY_TIME, CYCLE_WEEKLY_* env vars
- Add SALES_CLOSE_BEFORE_DRAW_MINUTES and CYCLES_TO_GENERATE_AHEAD
- Fix SQLite parameter issue in scheduler

Frontend:
- Add 'Save This Link' section with copy button on ticket status page
- Improve draw animation to show immediately when draw starts
- Show 'Waiting for next round...' instead of 'Drawing Now!' after draw
- Hide Buy Tickets button when waiting for next round
- Skip draw animation if no tickets were sold
- Keep winner screen open longer (15s) for next cycle to load
- Auto-refresh to next lottery cycle after draw

Telegram Bot:
- Various improvements and fixes
2025-11-28 03:24:17 +00:00
Michilis
f743a6749c feat: Add Telegram bot with group support
- Full Telegram bot implementation for Lightning Jackpot
- Commands: /start, /buy, /tickets, /wins, /address, /jackpot, /help
- Lightning invoice generation with QR codes
- Payment polling and confirmation notifications
- User state management (Redis/in-memory fallback)
- Group support with admin settings panel
- Configurable draw announcements and reminders
- Centralized messages for easy i18n
- Docker configuration included
2025-11-27 23:10:25 +00:00