Files
tipibot/.env.example
Rene Arumetsa d1cf6cdbd1 feat(economy): add /lottery - daily draw, weighted winner takes the pot
Buy tickets (200 coins each, max 100/draw); one winner is drawn daily at 21:00
Tallinn time weighted by ticket count and credited the whole pot. Coin-conserving
by design: each ticket's cost is deducted at purchase and the winner is minted
exactly the sum of all ticket spend - no shared pot record, so no cross-period
race. Ticket state lives per-user keyed by draw period (full scan only at draw
time and for the pot view).

- New lottery.py: TICKET_COST/MAX_TICKETS/DRAW_HOUR, pure period_for, and
  do_buy_ticket / get_lottery_state / do_lottery_draw. New lottery_tickets +
  lottery_period schema fields (period added to _TEXT_FIELDS).
- /lottery [kogus] command (view or buy) with full failure handling.
- Scheduled lottery_draw_daily loop in bot.py (both profiles; each draws its own
  collection), announcing to the optional LOTTERY_CHANNEL_ID (config + .env).

14 tests: period boundary, buy/accumulate/reset/caps/guards, pot state, draw
payout with coin conservation, and the more-tickets-wins-more weighting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VbAVsrZuYesea99mPMmPT
2026-09-04 03:10:42 +03:00

51 lines
1.7 KiB
Plaintext

# Profile-specific Discord bot tokens (from https://discord.com/developers/applications)
DISCORD_TOKEN_DEV=your-dev-bot-token-here
DISCORD_TOKEN_ECONOMY=your-economy-bot-token-here
# Legacy fallback token (optional, backward compatibility)
DISCORD_TOKEN=
# Google Sheets spreadsheet ID (the long string in the sheet URL)
SHEET_ID=your-google-sheet-id-here
# Path to Google service account credentials JSON
GOOGLE_CREDS_PATH=credentials.json
# Profile-specific guild (server) IDs - right-click your server with dev mode on
GUILD_ID_DEV=your-dev-guild-id-here
GUILD_ID_ECONOMY=your-economy-guild-id-here
# Legacy fallback guild ID (optional, backward compatibility)
GUILD_ID=
# Channel ID where birthday announcements are posted (dev profile)
BIRTHDAY_CHANNEL_ID_DEV=your-dev-birthday-channel-id-here
# Optional birthday channel for economy profile (normally unset for economy-only bot)
BIRTHDAY_CHANNEL_ID_ECONOMY=
# Legacy fallback birthday channel ID (optional, backward compatibility)
BIRTHDAY_CHANNEL_ID=
# How many days before a birthday the on-join check counts as "coming up"
BIRTHDAY_WINDOW_DAYS=7
# Channel ID where the daily lottery draw result is announced (optional - the
# draw still runs and pays the winner if unset; per-profile like BIRTHDAY_CHANNEL)
LOTTERY_CHANNEL_ID_DEV=
LOTTERY_CHANNEL_ID_ECONOMY=
LOTTERY_CHANNEL_ID=
# PocketBase backend (https://pocketbase.io)
PB_URL=http://127.0.0.1:8090
PB_ADMIN_EMAIL=admin@example.com
PB_ADMIN_PASSWORD=your-pb-admin-password
# Profile-specific PocketBase collections
PB_ECONOMY_COLLECTION_DEV=economy_users_dev
PB_ECONOMY_COLLECTION_ECONOMY=economy_users_prod
# Legacy fallback collection name (optional, backward compatibility)
PB_ECONOMY_COLLECTION=