Initial commit
This commit is contained in:
22
.env.example
Normal file
22
.env.example
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Discord bot token (from https://discord.com/developers/applications)
|
||||||
|
DISCORD_TOKEN=your-bot-token-here
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Guild (server) ID - right-click your server with dev mode on
|
||||||
|
GUILD_ID=your-guild-id-here
|
||||||
|
|
||||||
|
# Channel ID where birthday announcements are posted (bot sends @here on the birthday at 09:00 Tallinn time)
|
||||||
|
BIRTHDAY_CHANNEL_ID=your-channel-id-here
|
||||||
|
|
||||||
|
# How many days before a birthday the on-join check counts as "coming up"
|
||||||
|
BIRTHDAY_WINDOW_DAYS=7
|
||||||
|
|
||||||
|
# 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
|
||||||
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
.env
|
||||||
|
credentials.json
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
data/restart_channel.json
|
||||||
|
data/economy.json
|
||||||
|
pocketbase.exe
|
||||||
|
pocketbase
|
||||||
|
pb_data/
|
||||||
|
pb_migrations/
|
||||||
195
DEV_NOTES.md
Normal file
195
DEV_NOTES.md
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
# TipiLAN Bot - Developer Reference
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `bot.py` | All Discord commands, views (UI components), event handlers, reminder system |
|
||||||
|
| `economy.py` | All economy logic, data model, constants (SHOP, COOLDOWNS, LEVEL_ROLES, etc.) |
|
||||||
|
| `pb_client.py` | Async PocketBase REST client - auth token cache, CRUD on `economy_users` collection |
|
||||||
|
| `strings.py` | **Single source of truth for all user-facing text.** Edit here to change any message. |
|
||||||
|
| `sheets.py` | Google Sheets integration (member sync) |
|
||||||
|
| `member_sync.py` | Birthday/member sync background task |
|
||||||
|
| `config.py` | Environment variables (TOKEN, GUILD_ID, PB_URL, etc.) |
|
||||||
|
| `migrate_to_pb.py` | One-time utility: migrate `data/economy.json` → PocketBase |
|
||||||
|
| `add_stats_fields.py` | Schema migration: add new fields to `economy_users` PocketBase collection |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Economy Command
|
||||||
|
|
||||||
|
Checklist - do all of these, in order:
|
||||||
|
|
||||||
|
1. **`economy.py`** - add the `do_<cmd>` async function with cooldown check, logic, `_commit`, and `_txn` logging
|
||||||
|
2. **`economy.py`** - add the cooldown to `COOLDOWNS` dict if it has one
|
||||||
|
3. **`economy.py`** - add the EXP reward to `EXP_REWARDS` dict
|
||||||
|
3a. **PocketBase** - if the function stores new fields, add them as columns via `python scripts/add_stats_fields.py` (or manually in the PB admin UI at `http://127.0.0.1:8090/_/`). Fields not in the PB schema are silently dropped on PATCH.
|
||||||
|
4. **`strings.py` `CMD`** - add the slash command description
|
||||||
|
5. **`strings.py` `OPT`** - add any parameter descriptions
|
||||||
|
6. **`strings.py` `TITLE`** - add embed title(s) for success/fail states
|
||||||
|
7. **`strings.py` `ERR`** - add any error messages (banned, cooldown uses `CD_MSG`, jailed uses `CD_MSG["jailed"]`)
|
||||||
|
8. **`strings.py` `CD_MSG`** - add cooldown message if command has a cooldown
|
||||||
|
9. **`strings.py` `HELP_CATEGORIES["tipibot"]["fields"]`** - add the command to the help embed
|
||||||
|
10. **`bot.py`** - implement the `cmd_<name>` function, handle all `res["reason"]` cases
|
||||||
|
11. **`bot.py`** - call `_maybe_remind` if the command has a cooldown and reminders make sense
|
||||||
|
12. **`bot.py`** - call `_award_exp(interaction, economy.EXP_REWARDS["<cmd>"])` on success
|
||||||
|
13. **`strings.py` `REMINDER_OPTS`** - add a reminder option if the command needs one
|
||||||
|
14. **`bot.py` `_maybe_remind`** - if the command has an item-modified cooldown, add an `elif` branch
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Shop Item
|
||||||
|
|
||||||
|
Checklist:
|
||||||
|
|
||||||
|
1. **`economy.py` `SHOP`** - add the item dict `{name, emoji, cost, description: strings.ITEM_DESCRIPTIONS["key"]}`
|
||||||
|
2. **`economy.py` `SHOP_TIERS`** - add the key to the correct tier list (1/2/3)
|
||||||
|
3. **`economy.py` `SHOP_LEVEL_REQ`** - add minimum level if it is T2 (≥10) or T3 (≥20)
|
||||||
|
4. **`strings.py` `ITEM_DESCRIPTIONS`** - add the item description (Estonian flavour + English effect)
|
||||||
|
5. **`strings.py` `HELP_CATEGORIES["shop"]["fields"]`** - add display entry (sorted by cost)
|
||||||
|
6. If the item modifies a cooldown:
|
||||||
|
- **`economy.py`** - add the `if "item" in user["items"]` branch in the relevant `do_<cmd>` function
|
||||||
|
- **`bot.py` `_maybe_remind`** - add `elif cmd == "<cmd>" and "<item>" in items:` branch with the new delay
|
||||||
|
- **`bot.py` `cmd_cooldowns`** - add the item annotation to the relevant status line
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Level Role
|
||||||
|
|
||||||
|
1. **`economy.py` `LEVEL_ROLES`** - add `(min_level, "RoleName")` in descending level order (highest first)
|
||||||
|
2. **`bot.py` `_ensure_level_role`** - no changes needed (uses `LEVEL_ROLES` dynamically)
|
||||||
|
3. Run **`/economysetup`** in the server to create the role and set its position
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Admin Command
|
||||||
|
|
||||||
|
1. **`strings.py` `CMD`** - add `"[Admin] ..."` description
|
||||||
|
2. **`strings.py` `HELP_CATEGORIES["admin"]["fields"]`** - add the entry
|
||||||
|
3. **`bot.py`** - add `@app_commands.default_permissions(manage_guild=True)` and `@app_commands.guild_only()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Economy System Design
|
||||||
|
|
||||||
|
### Storage
|
||||||
|
|
||||||
|
All economy state is stored in **PocketBase** (`economy_users` collection). `pb_client.py` owns all reads/writes. Each `do_*` function in `economy.py` calls `get_user()` → mutates the local dict → calls `_commit()`. `_commit` does a `PATCH` to PocketBase.
|
||||||
|
|
||||||
|
### Currency & Income Sources
|
||||||
|
|
||||||
|
| Command | Cooldown | Base Earn | Notes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `/daily` | 20h (18h w/ korvaklapid) | 150⬡ | ×streak multiplier, ×2 w/ lan_pass, +5% interest w/ gaming_laptop |
|
||||||
|
| `/work` | 1h (40min w/ monitor) | 15-75⬡ | ×1.5 w/ gaming_hiir, ×1.25 w/ reguleeritav_laud, ×3 30% chance w/ energiajook |
|
||||||
|
| `/beg` | 5min (3min w/ hiirematt) | 10-40⬡ | ×2 w/ klaviatuur |
|
||||||
|
| `/crime` | 2h | 200-500⬡ win | 60% success (75% w/ cat6), +30% w/ mikrofon; fail = fine + jail |
|
||||||
|
| `/rob` | 2h | 10–25% of target | 45% success (60% w/ jellyfin); fail = fine; cannot rob TipiBOT |
|
||||||
|
| `/heist` | 4h personal + 1h global | 20–55% of house / n players | solo allowed, max 8; 35%+5%/player success (cap 65%); fail = 3h jail + ~15% balance fine |
|
||||||
|
| `/slots` | - | varies | pair=+0.5× bet; triple tiered: heart×4, fire×5, troll×7, cry×10, skull×15, karikas×25 (jackpot); ×1.5 w/ monitor_360; miss=lose bet; house edge ~5% |
|
||||||
|
| `/roulette` | - | 2× red/black, 14× green | 1/37 green chance |
|
||||||
|
| `/blackjack` | - | 1:1 win, 3:2 BJ, 2:1 double | Dealer stands on 17+; double down on first action only |
|
||||||
|
|
||||||
|
### "all" Keyword
|
||||||
|
Commands that accept a coin amount (`/give`, `/roulette`, `/rps`, `/slots`, `/blackjack`) accept `"all"` to mean the user's full current balance. Parsed by `_parse_amount(value, balance)` in `bot.py`.
|
||||||
|
|
||||||
|
### Daily Streak Multipliers
|
||||||
|
- 1-2 days: ×1.0 (150⬡)
|
||||||
|
- 3-6 days: ×1.5 (225⬡)
|
||||||
|
- 7-13 days: ×2.0 (300⬡)
|
||||||
|
- 14+ days: ×3.0 (450⬡)
|
||||||
|
- `karikas` item: streak survives missed days
|
||||||
|
|
||||||
|
### Jail
|
||||||
|
- Normal duration: 30 minutes (`JAIL_DURATION`)
|
||||||
|
- Heist fail duration: 3 hours (`HEIST_JAIL`) + fine 15% of balance (min 150⨡, max 1000⨡)
|
||||||
|
- `gaming_tool`: prevents jail on crime fail
|
||||||
|
- `/jailbreak`: 3 dice rolls, need doubles to escape free. On fail - bail = 20-30% of balance, min 350⬡. If balance < 350⬡, player stays jailed until timer.
|
||||||
|
|
||||||
|
### EXP Rewards (from `EXP_REWARDS` in economy.py)
|
||||||
|
EXP is awarded on every successful command use. Level formula: `floor(sqrt(exp / 10))`, so Level 5 = 250 EXP, Level 10 = 1000, Level 20 = 4000, Level 30 = 9000.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role Hierarchy (Discord)
|
||||||
|
|
||||||
|
Order top to bottom in server roles:
|
||||||
|
|
||||||
|
```
|
||||||
|
[Bot managed role] ← bot's own role, always at top of our stack
|
||||||
|
ECONOMY ← given to everyone who uses any economy command
|
||||||
|
TipiLEGEND ← level 30+
|
||||||
|
TipiCHAD ← level 20+
|
||||||
|
TipiHUSTLER ← level 10+
|
||||||
|
TipiGRINDER ← level 5+
|
||||||
|
TipiNOOB ← level 1+
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `/economysetup` to auto-create all roles and set their positions. The command is idempotent - safe to run multiple times.
|
||||||
|
|
||||||
|
Role assignment:
|
||||||
|
- **ECONOMY** role: given automatically on first EXP award (i.e. first successful economy command)
|
||||||
|
- **Level roles**: given/swapped automatically on level-up; synced on `/rank`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Shop Tiers & Level Requirements
|
||||||
|
|
||||||
|
| Tier | Level Required | Items |
|
||||||
|
|---|---|---|
|
||||||
|
| T1 | 0 (any) | gaming_hiir, hiirematt, korvaklapid, lan_pass, anticheat, energiajook, gaming_laptop |
|
||||||
|
| T2 | 10 | reguleeritav_laud, jellyfin, mikrofon, klaviatuur, monitor, cat6 |
|
||||||
|
| T3 | 20 | monitor_360, karikas, gaming_tool |
|
||||||
|
|
||||||
|
Shop display is sorted by cost (ascending) within each tier.
|
||||||
|
The `SHOP_LEVEL_REQ` dict in `economy.py` controls per-item lock thresholds.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## strings.py Organisation
|
||||||
|
|
||||||
|
| Section | Dict | Usage in bot.py |
|
||||||
|
|---|---|---|
|
||||||
|
| Flavour text | `WORK_JOBS`, `BEG_LINES`, `CRIME_WIN`, `CRIME_LOSE` | Randomised descriptions |
|
||||||
|
| Command descriptions | `CMD["key"]` | `@tree.command(description=S.CMD["key"])` |
|
||||||
|
| Parameter descriptions | `OPT["key"]` | `@app_commands.describe(param=S.OPT["key"])` |
|
||||||
|
| Help embed | `HELP_CATEGORIES["cat"]` | `cmd_help` |
|
||||||
|
| Banned message | `MSG_BANNED` | All banned checks |
|
||||||
|
| Reminder options | `REMINDER_OPTS` | `RemindersSelect` dropdown |
|
||||||
|
| Slots outcomes | `SLOTS_TIERS["tier"]` → `(title, color)` | `cmd_slots` |
|
||||||
|
| Embed titles | `TITLE["key"]` | `discord.Embed(title=S.TITLE["key"])` |
|
||||||
|
| Error messages | `ERR["key"]` | `send_message(S.ERR["key"])` - use `.format(**kwargs)` for dynamic parts |
|
||||||
|
| Cooldown messages | `CD_MSG["cmd"].format(ts=_cd_ts(...))` | Cooldown responses |
|
||||||
|
| Shop UI | `SHOP_UI["key"]` | `_shop_embed` |
|
||||||
|
| Item descriptions | `ITEM_DESCRIPTIONS["item_key"]` | `economy.SHOP[key]["description"]` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Constants Location Quick-Reference
|
||||||
|
|
||||||
|
| Constant | File | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| `SHOP` | `economy.py` | All shop items (name, emoji, cost, description) |
|
||||||
|
| `SHOP_TIERS` | `economy.py` | Which items are in T1/T2/T3 |
|
||||||
|
| `SHOP_LEVEL_REQ` | `economy.py` | Min level per item |
|
||||||
|
| `COOLDOWNS` | `economy.py` | Base cooldown per command |
|
||||||
|
| `JAIL_DURATION` | `economy.py` | How long jail lasts |
|
||||||
|
| `LEVEL_ROLES` | `economy.py` | `[(min_level, "RoleName"), ...]` highest first |
|
||||||
|
| `ECONOMY_ROLE` | `economy.py` | Name of the base economy participation role |
|
||||||
|
| `EXP_REWARDS` | `economy.py` | EXP per command |
|
||||||
|
| `HOUSE_ID` | `economy.py` | Bot's user ID (house account for /rob) |
|
||||||
|
| `MIN_BAIL` | `economy.py` | Minimum bail payment (350⬡) |
|
||||||
|
| `COIN` | `economy.py` | The coin emoji string |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Balance Notes (as of current version)
|
||||||
|
|
||||||
|
- **Beg** is most efficient for active players (3min cooldown + 2× multiplier w/ `klaviatuur` = high ⬡/hr)
|
||||||
|
- **Work** is best for passive players (1h cooldown, fire and forget)
|
||||||
|
- **Crime** is high risk/reward - best with `cat6` + `mikrofon`
|
||||||
|
- **`lan_pass`** (1200⬡) doubles daily - good long-term investment
|
||||||
|
- **`gaming_laptop`** (1500⬡) 5% interest, capped 500⬡/day - snowballs with large balance
|
||||||
|
- `anticheat` is consumable (2 uses) - only item that can be re-bought
|
||||||
|
- `karikas` (T3) is the only item that preserves a daily streak across missed days
|
||||||
|
- `reguleeritav_laud` (T2) stacks with `gaming_hiir`: combined ×1.5 × ×1.25 = ×1.875
|
||||||
17
LICENSE.md
Normal file
17
LICENSE.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2022 - present, Gani Georgiev
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||||
|
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
|
||||||
|
is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||||
|
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
429
README.md
Normal file
429
README.md
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
# TipiLAN Bot
|
||||||
|
|
||||||
|
Discord bot for the TipiLAN community. Manages member roles and nicknames via Google Sheets, announces birthdays, and runs the TipiCOIN economy.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
1. [Setup](#setup)
|
||||||
|
2. [Member Management](#member-management)
|
||||||
|
3. [Admin Commands](#admin-commands)
|
||||||
|
4. [Birthday System](#birthday-system)
|
||||||
|
5. [TipiCOIN Economy](#tipicoin-economy)
|
||||||
|
6. [Project Structure](#project-structure)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### 1. Discord Application
|
||||||
|
|
||||||
|
- **Bot token** - Settings → Bot → Token → Copy
|
||||||
|
- **Server Members Intent** must be **ON** - Settings → Bot → Privileged Gateway Intents
|
||||||
|
- Bot invite scopes: `bot` + `applications.commands`
|
||||||
|
- Required permissions: Manage Roles, Manage Nicknames, View Channels, Send Messages, Embed Links, Read Message History
|
||||||
|
|
||||||
|
> Permissions integer: `402738176`
|
||||||
|
|
||||||
|
### 2. Google Service Account
|
||||||
|
|
||||||
|
1. [Google Cloud Console](https://console.cloud.google.com/) → create/select project
|
||||||
|
2. Enable **Google Sheets API** and **Google Drive API**
|
||||||
|
3. Credentials → Create Credentials → Service Account
|
||||||
|
4. Download JSON key → save as `credentials.json` in the project root
|
||||||
|
5. Share your Google Sheet with the service account `client_email` - give **Editor** access
|
||||||
|
|
||||||
|
### 3. Google Sheet Format
|
||||||
|
|
||||||
|
Row 1 = headers (exact names). Row 2 = formula/stats row (skipped by bot). Data starts row 3.
|
||||||
|
|
||||||
|
| Column | What the bot does with it |
|
||||||
|
|---|---|
|
||||||
|
| **Nimi** | Sets Discord nickname: first name + last initial (`Mari-Liis Tamm` → `Mari-Liis T`) |
|
||||||
|
| **Organisatsioon** | Maps to a Discord role (comma-separated for multiple) |
|
||||||
|
| **Meil** | Read-only |
|
||||||
|
| **Discord** | Username used for initial matching |
|
||||||
|
| **User ID** | Bot writes numeric Discord ID here once matched |
|
||||||
|
| **Sünnipäev** | Birthday - accepts `DD/MM/YYYY`, `YYYY-MM-DD`, `MM-DD`. Years outside 1920-now ignored |
|
||||||
|
| **Telefon** | Read-only |
|
||||||
|
| **Valdkond** | Maps to a Discord role (comma-separated) |
|
||||||
|
| **Roll** | Maps to a Discord role (comma-separated) |
|
||||||
|
| **Discordis synced?** | Bot writes `TRUE`/`FALSE` checkbox after each sync |
|
||||||
|
| **Groupi lisatud?** | Managed externally |
|
||||||
|
|
||||||
|
**Empty cell values** - the bot treats blank cells, `"-"`, `"x"`, `"n/a"`, `"none"`, `"ei"` as empty/skipped.
|
||||||
|
|
||||||
|
**Role name mapping** - some sheet values map to different Discord role names. Trailing punctuation (`.`, `,`, `;` etc.) is stripped from sheet values before lookup, so `"Messiala."` correctly matches the `Messiala` Discord role:
|
||||||
|
|
||||||
|
| Sheet value | Discord role |
|
||||||
|
|---|---|
|
||||||
|
| `Juht` | `Tiimijuht` |
|
||||||
|
| `Admin` | `+` |
|
||||||
|
|
||||||
|
**Base roles** - two role IDs in `config.py → BASE_ROLE_IDS` are added to every synced member automatically.
|
||||||
|
|
||||||
|
### 4. PocketBase (Economy Database)
|
||||||
|
|
||||||
|
The economy system stores all player data in [PocketBase](https://pocketbase.io/).
|
||||||
|
|
||||||
|
1. Download `pocketbase.exe` (Windows) from https://pocketbase.io/docs/ and place it in the project root.
|
||||||
|
2. Start PocketBase: `.\pocketbase.exe serve`
|
||||||
|
3. Open the admin UI at http://127.0.0.1:8090/_/ and create a superuser account.
|
||||||
|
4. Create a collection named `economy_users` - see `docs/POCKETBASE_SETUP.md` for the full schema.
|
||||||
|
5. Set `PB_URL`, `PB_ADMIN_EMAIL`, `PB_ADMIN_PASSWORD` in `.env`.
|
||||||
|
6. **One-time data migration** (only if you have an existing `data/economy.json`): `python scripts/migrate_to_pb.py`
|
||||||
|
|
||||||
|
> PocketBase must be running before the bot starts. `pocketbase.exe` and `pb_data/` are gitignored.
|
||||||
|
|
||||||
|
### 5. Environment Variables
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Windows
|
||||||
|
copy .env.example .env
|
||||||
|
|
||||||
|
# macOS/Linux
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
|---|---|
|
||||||
|
| `DISCORD_TOKEN` | Bot token from Discord Developer Portal |
|
||||||
|
| `SHEET_ID` | ID from the Google Sheet URL |
|
||||||
|
| `GOOGLE_CREDS_PATH` | Path to `credentials.json` (default: `credentials.json`) |
|
||||||
|
| `GUILD_ID` | Right-click server → Copy Server ID (Developer Mode on) |
|
||||||
|
| `BIRTHDAY_CHANNEL_ID` | Channel for birthday `@here` pings |
|
||||||
|
| `BIRTHDAY_WINDOW_DAYS` | Days before birthday that on-join check flags it (default: 7) |
|
||||||
|
| `PB_URL` | PocketBase base URL (default: `http://127.0.0.1:8090`) |
|
||||||
|
| `PB_ADMIN_EMAIL` | PocketBase superuser e-mail |
|
||||||
|
| `PB_ADMIN_PASSWORD` | PocketBase superuser password |
|
||||||
|
|
||||||
|
### 6. Install & Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m venv .venv
|
||||||
|
.venv\Scripts\activate # Windows
|
||||||
|
# source .venv/bin/activate # macOS/Linux
|
||||||
|
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Terminal 1 - keep running
|
||||||
|
.\pocketbase.exe serve
|
||||||
|
|
||||||
|
# Terminal 2
|
||||||
|
python bot.py
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Member Management
|
||||||
|
|
||||||
|
### On member join
|
||||||
|
- Bot looks the member up in the sheet by **Discord username**
|
||||||
|
- If found → sets nickname, assigns roles, writes back User ID, marks synced
|
||||||
|
- If **not found** → creates a new sheet row with their `Discord` username and `User ID` pre-filled. Admin fills in the rest, then runs `/check`
|
||||||
|
|
||||||
|
### Matching logic
|
||||||
|
1. Match by **User ID** (numeric, reliable - IDs never change)
|
||||||
|
2. Fall back to **Discord username** (case-insensitive) if no ID yet
|
||||||
|
3. Once matched by username, the bot writes the ID back so future matches are by ID
|
||||||
|
|
||||||
|
### Nickname format
|
||||||
|
`Nimi` column → first name + last name initial. Hyphenated first names preserved.
|
||||||
|
|
||||||
|
| Nimi | Nickname |
|
||||||
|
|---|---|
|
||||||
|
| Mari Tamm | Mari T |
|
||||||
|
| Mari-Liis Tamm | Mari-Liis T |
|
||||||
|
| Jaan | Jaan |
|
||||||
|
|
||||||
|
### Synced status
|
||||||
|
A member is marked `Discordis synced? = TRUE` when their sync completes with no errors.
|
||||||
|
Admins (bot lacks permission to modify them) are silently skipped and still marked synced.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Admin Commands
|
||||||
|
|
||||||
|
> These commands are hidden from users who don't have the required permission. Override per-role in **Server Settings → Integrations → Bot**.
|
||||||
|
|
||||||
|
| Command | Permission | What it does |
|
||||||
|
|---|---|---|
|
||||||
|
| `/check` | Manage Roles | Refreshes sheet data, backfills missing User IDs, syncs nicknames + roles for every member, reports stats |
|
||||||
|
| `/member @user` | Manage Roles | Shows a member's full sheet data + calculated age |
|
||||||
|
| `/sync` | Manage Guild | Re-registers slash commands with Discord |
|
||||||
|
| `/restart` | Manage Guild | Gracefully restarts the bot process; posts ✅ in the same channel when back up |
|
||||||
|
| `/shutdown` | Manage Guild | Shuts the bot down cleanly without restarting |
|
||||||
|
| `/pause` | Manage Guild | Toggles maintenance mode — blocks all non-admin commands; calling again unpauses |
|
||||||
|
| `/send #channel message` | Manage Guild | Sends a message to any channel as the bot |
|
||||||
|
| `/status` | Manage Guild | Bot uptime, RAM, CPU, latency, cache stats, economy user count |
|
||||||
|
| `/admincoins @user <kogus> <põhjus>` | Manage Guild | Give (positive) or take (negative) TipiCOINi. Balance floored at 0. User gets a DM with reason. |
|
||||||
|
| `/adminjail @user <minutid> <põhjus>` | Manage Guild | Manually jail a user for N minutes. User gets a DM. |
|
||||||
|
| `/adminunjail @user` | Manage Guild | Release a user from jail immediately. |
|
||||||
|
| `/adminban @user <põhjus>` | Manage Guild | Ban a user from all economy commands. User gets a DM. |
|
||||||
|
| `/adminunban @user` | Manage Guild | Lift an economy ban. |
|
||||||
|
| `/adminreset @user <põhjus>` | Manage Guild | Wipe a user's balance, items, and streak to zero. User gets a DM. |
|
||||||
|
| `/adminview @user` | Manage Guild | Inspect a user's full economy profile: balance, streak, items, jail status, ban status. |
|
||||||
|
|
||||||
|
### `/check` output example
|
||||||
|
```
|
||||||
|
🔑 Täideti 3 puuduvat kasutaja ID-d.
|
||||||
|
✅ Korras: 54
|
||||||
|
🔧 Parandatud: 3
|
||||||
|
❓ Ei leitud: 1
|
||||||
|
⚠️ Vead: 2
|
||||||
|
|
||||||
|
Üksikasjad:
|
||||||
|
🔧 Mari T: +rollid: TipiSÕBER
|
||||||
|
⚠️ Rolli 'Messiala' ei leitud serverist
|
||||||
|
|
||||||
|
📊 Tabeli statistika - 58 liiget
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Birthday System
|
||||||
|
|
||||||
|
### Daily announcement
|
||||||
|
Every day at **09:00 Tallinn time** the bot checks all sheet rows and pings `@here` in `BIRTHDAY_CHANNEL_ID` for anyone whose birthday is today.
|
||||||
|
|
||||||
|
**Duplicate prevention** - announcements are logged to `birthday_sent.json` keyed by date. Bot restart on a birthday day does **not** re-ping. Log is auto-cleaned after 2 days.
|
||||||
|
|
||||||
|
### `/birthdays`
|
||||||
|
Paginated embed with **12 pages** - one per calendar month. Opens on the **current month**. Navigate with ◀/▶. Each entry shows:
|
||||||
|
- Member mention (if their User ID is known) or name
|
||||||
|
- Birthday date
|
||||||
|
- Days until next birthday (or 🎉 if today)
|
||||||
|
|
||||||
|
### On member join
|
||||||
|
If a member joins and their birthday is within `BIRTHDAY_WINDOW_DAYS` days, a birthday announcement is sent.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## TipiCOIN Economy
|
||||||
|
|
||||||
|
All economy data is stored in **PocketBase** (`economy_users` collection - see `pb_client.py`). The currency is **TipiCOIN** (⬡), displayed as a custom Discord emoji configured in `economy.py → COIN`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### House account
|
||||||
|
|
||||||
|
The bot has its own TipiCOIN balance (the "house"). Coins flow **into** the house when players lose:
|
||||||
|
|
||||||
|
- `/roulette` - lost bets
|
||||||
|
- `/slots` - missed bets
|
||||||
|
- `/blackjack` - lost bets
|
||||||
|
- `/rps` - lost bets (vs bot or PvP)
|
||||||
|
- `/crime` - failure fines
|
||||||
|
- `/rob` - failure fines and anticheat counter-fines
|
||||||
|
|
||||||
|
The house is listed at **#0** on the leaderboard. Players can attempt to rob it via `/rob @TipiBOT` with special jackpot odds (35% success, 5–40% of the house balance).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Earning coins
|
||||||
|
|
||||||
|
| Command | Cooldown | Base payout | Notes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `/daily` | 20h | 150 ⬡ | Streak multiplier applied (see below). Kõrvaklapid reduces cooldown to 18h. LAN Pilet doubles the reward. Botikoobas adds 5% interest on your balance (capped at 500 ⬡/day). |
|
||||||
|
| `/work` | 1h | 15–75 ⬡ | Random job flavour text. Mängurihiir +50%, Reguleeritav laud +25% (stacks). Red Bull: 30% chance of ×3. Ultralai monitor reduces cooldown to 40min. |
|
||||||
|
| `/beg` | 5min | 10–40 ⬡ | XL hiirematt reduces cooldown to 3min. Mehhaaniline klaviatuur multiplies earnings ×2. |
|
||||||
|
| `/crime` | 2h | 200–500 ⬡ | 60% success rate (75% with CAT6). +30% earnings with Mikrofon on win. Fail = fine + 30min jail. Mänguritool skips jail on fail. |
|
||||||
|
|
||||||
|
### Daily streak
|
||||||
|
|
||||||
|
The streak increments each time you claim `/daily` within the cooldown window. Missing a day resets it to 1 **unless** you own the TipiLAN trofee item.
|
||||||
|
|
||||||
|
| Streak | Multiplier | Payout (base) |
|
||||||
|
|---|---|---|
|
||||||
|
| 1–2 days | ×1.0 | 150 ⬡ |
|
||||||
|
| 3–6 days | ×1.5 | 225 ⬡ |
|
||||||
|
| 7–13 days | ×2.0 | 300 ⬡ |
|
||||||
|
| 14+ days | ×3.0 | 450 ⬡ |
|
||||||
|
|
||||||
|
> With LAN Pilet (×2 daily) and a 14-day streak (×3.0) the base payout reaches **900 ⬡**. Add Botikoobas 5% interest on top.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### EXP & levels
|
||||||
|
|
||||||
|
Every successful economy action awards EXP:
|
||||||
|
|
||||||
|
| Action | EXP |
|
||||||
|
|---|---|
|
||||||
|
| `/daily` claimed | +50 |
|
||||||
|
| `/work` completed | +25 |
|
||||||
|
| `/crime` success | +15 |
|
||||||
|
| `/rob` success | +15 |
|
||||||
|
| Gambling win (`/roulette`, `/slots`, `/blackjack`) | Scaled by bet: <10⬡ = 0, 10–99⬡ = +5, 100–999⬡ = +10, 1 000–9 999⬡ = +15, 10 000–99 999⬡ = +20, 100 000+⬡ = +25 |
|
||||||
|
| `/beg` completed | +5 |
|
||||||
|
|
||||||
|
**Level formula:** `level = floor(√(total_exp ÷ 10))`
|
||||||
|
|
||||||
|
| Level | EXP required | Milestone |
|
||||||
|
|---|---|---|
|
||||||
|
| 1 | 10 | TipiNOOB role |
|
||||||
|
| 5 | 250 | TipiGRINDER role |
|
||||||
|
| 10 | 1 000 | TipiHUSTLER role · **T2 shop unlocks** |
|
||||||
|
| 20 | 4 000 | TipiCHAD role · **T3 shop unlocks** |
|
||||||
|
| 30 | 9 000 | TipiLEGEND role |
|
||||||
|
|
||||||
|
Use `/rank` to see your current EXP, level, progress bar to the next level, and leaderboard position.
|
||||||
|
|
||||||
|
### Level roles
|
||||||
|
|
||||||
|
Roles are assigned automatically on level-up and re-synced when you run `/rank`.
|
||||||
|
|
||||||
|
| Role | Min level |
|
||||||
|
|---|---|
|
||||||
|
| TipiNOOB | 1 |
|
||||||
|
| TipiGRINDER | 5 |
|
||||||
|
| TipiHUSTLER | 10 |
|
||||||
|
| TipiCHAD | 20 |
|
||||||
|
| TipiLEGEND | 30 |
|
||||||
|
|
||||||
|
The **ECONOMY** role is granted on your first EXP award (i.e. first successful economy command). Run `/economysetup` (admin) once to create all roles and position them correctly below the bot's own role.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Gambling
|
||||||
|
|
||||||
|
| Command | Notes |
|
||||||
|
|---|---|
|
||||||
|
| `/roulette <panus> <värv>` | Red/black pays ×2 (≈50% each). Green pays ×14 at 1/37 chance. Lost bets go to the house. |
|
||||||
|
| `/slots <panus>` | 3 reels. **Pair** = +50% of bet. **Triple** = tiered by symbol rarity (×4 heart → ×15 skull, ×1.5 with 360hz monitor). **Jackpot** (3 karikas) = ×25 (×37 with 360hz monitor). Miss = lose bet. |
|
||||||
|
| `/blackjack <panus>` | Standard rules. Dealer stands on 17+. Natural blackjack pays 3:2. Double down on first action only. Split identical rank cards (one extra bet). Lost bets go to the house. |
|
||||||
|
| `/rps [panus]` | Rock Paper Scissors vs. the bot with optional bet. Bot picks randomly. |
|
||||||
|
| `/rps [panus] @vastane` | PvP duel - both players pick privately via DM, result posted to the server. Bet transferred to winner. |
|
||||||
|
|
||||||
|
### Social
|
||||||
|
|
||||||
|
| Command | Notes |
|
||||||
|
|---|---|
|
||||||
|
| `/rob @user` | 45% success (60% with Jellyfin). Target must have ≥100 ⬡. Steal 10–25% of target's balance. Fail = fine of 100–250 ⬡ to the house. Anticheat blocks the rob and fines the robber (2 charges per purchase). Cannot rob TipiBOT - use `/heist` instead. |
|
||||||
|
| `/heist` | Start a bank robbery. Solo or group (max 8). 5-minute join window. Success: 35% base + 5% per extra player (cap 65%). Win = split **20–55%** of house balance equally. Fail = **1h 30min jail + ~15% balance fine** for all. 4h personal cooldown + 1h global server cooldown after each event. |
|
||||||
|
| `/give @user <summa>` | Transfer coins directly to another player. **Jailed users cannot use this command.** |
|
||||||
|
| `/request <summa> <põhjus> [@sihtmärk]` | Post a crowdfunding request. Anyone (or a specific target) can click **Rahasta** to contribute via `/give`. Expires in 5 minutes. |
|
||||||
|
|
||||||
|
### Info commands
|
||||||
|
|
||||||
|
| Command | Notes |
|
||||||
|
|---|---|
|
||||||
|
| `/balance [@user]` | Balance, daily streak, owned items (with Anticheat charges remaining), jail status if jailed. |
|
||||||
|
| `/rank [@user]` | EXP total, current level, progress bar to next level, leaderboard rank. |
|
||||||
|
| `/stats [@user]` | Lifetime statistics: economy totals, work/beg counts, gambling records, crime/heist history, social totals, best streak. |
|
||||||
|
| `/cooldowns` | All cooldowns at a glance with live Discord timestamps. Shows jail timer if jailed. |
|
||||||
|
| `/leaderboard` | Paginated coin leaderboard (10/page). House pinned at #0. ◀/▶ to browse; 📍 **Mina** jumps to your page. Has a separate EXP/level tab. |
|
||||||
|
| `/shop` | Browse all items by tier. Shows owned status, Anticheat charges remaining, and level lock for T2/T3. |
|
||||||
|
| `/buy <item>` | Purchase an item by name (partial match accepted). |
|
||||||
|
| `/reminders` | Toggle per-command DM notifications. **All reminders are on by default.** Bot DMs you the moment each cooldown expires. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Jail system
|
||||||
|
|
||||||
|
`/crime` fail (without Mänguritool) jails you for **30 minutes**. While jailed, `/work`, `/beg`, `/crime`, `/rob`, and `/give` are blocked.
|
||||||
|
|
||||||
|
#### `/jailbreak`
|
||||||
|
Roll two dice - matching values (doubles) free you instantly. **3 attempts** per jail sentence. If all 3 fail you pay bail:
|
||||||
|
|
||||||
|
- **20–30% of your current balance** (scales with wealth)
|
||||||
|
- **Minimum 350 ⬡** - if your balance is below this you stay jailed until the timer runs out
|
||||||
|
|
||||||
|
Cooldowns and jail release times display as live Discord relative timestamps.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Shop items
|
||||||
|
|
||||||
|
All items are **permanent** once purchased **except Anticheat**, which expires after 2 uses and can be repurchased.
|
||||||
|
|
||||||
|
#### Tier 1 - any level
|
||||||
|
|
||||||
|
| Item | Cost | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| Mängurihiir | 500 ⬡ | `/work` earns +50% |
|
||||||
|
| XL hiirematt | 600 ⬡ | `/beg` cooldown 5min → 3min |
|
||||||
|
| Anticheat | 750 ⬡ | Rob attempts against you fail and fine the robber. **2 uses**, then repurchase. |
|
||||||
|
| Red Bull | 800 ⬡ | `/work` has 30% chance to earn ×3 |
|
||||||
|
| Kõrvaklapid | 1 200 ⬡ | `/daily` cooldown 20h → 18h |
|
||||||
|
| LAN Pilet | 1 200 ⬡ | `/daily` reward ×2 |
|
||||||
|
| Botikoobas | 1 500 ⬡ | `/daily` adds 5% interest on balance (capped at 500 ⬡/day) |
|
||||||
|
|
||||||
|
#### Tier 2 - level 10 required (TipiHUSTLER+)
|
||||||
|
|
||||||
|
| Item | Cost | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| Mehhaaniline klaviatuur | 1 800 ⬡ | `/beg` earns ×2 |
|
||||||
|
| Ultralai monitor | 2 500 ⬡ | `/work` cooldown 1h → 40min |
|
||||||
|
| Mikrofon | 2 800 ⬡ | `/crime` win earns +30% |
|
||||||
|
| Reguleeritav laud | 3 500 ⬡ | `/work` earns +25% (stacks with Mängurihiir → ×1.875 combined) |
|
||||||
|
| CAT6 netikaabel | 3 500 ⬡ | `/crime` success rate 60% → 75% |
|
||||||
|
| Jellyfin server | 4 000 ⬡ | `/rob` success rate 45% → 60% |
|
||||||
|
|
||||||
|
#### Tier 3 - level 20 required (TipiCHAD+)
|
||||||
|
|
||||||
|
| Item | Cost | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| TipiLAN trofee | 6 000 ⬡ | Daily streak survives missed days |
|
||||||
|
| 360hz monitor | 7 500 ⬡ | Slots jackpot 10× → 15×, triple 4× → 6× |
|
||||||
|
| Mänguritool | 9 000 ⬡ | `/crime` fail never sends you to jail |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Amount shortcuts
|
||||||
|
|
||||||
|
Commands that accept a coin amount (`/give`, `/roulette`, `/rps`, `/slots`, `/blackjack`) accept `"all"` as the amount to wager your entire balance.
|
||||||
|
|
||||||
|
### Custom emoji
|
||||||
|
Change `COIN` in `economy.py` to any Discord emoji string:
|
||||||
|
```python
|
||||||
|
COIN = "<:tipicoin:YOUR_EMOJI_ID>"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Logging
|
||||||
|
|
||||||
|
All logs are written to the `logs/` directory (auto-created on startup).
|
||||||
|
|
||||||
|
| File | Rotation | Contents |
|
||||||
|
|---|---|---|
|
||||||
|
| `logs/bot.log` | 5 MB x 5 backups | All INFO+ events: commands, errors, member sync |
|
||||||
|
| `logs/transactions.log` | Daily, 30 days | Economy transactions only: every balance change with user, amount, new balance |
|
||||||
|
|
||||||
|
The terminal output is **colour-coded** by log level (green = INFO, yellow = WARNING, red = ERROR).
|
||||||
|
|
||||||
|
Every slash command invocation is logged with the user ID, display name, and all options passed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
├── bot.py # Discord client, all slash commands, event handlers
|
||||||
|
├── economy.py # TipiCOIN business logic, constants (SHOP, COOLDOWNS, etc.)
|
||||||
|
├── pb_client.py # Async PocketBase REST client (auth + CRUD for economy_users)
|
||||||
|
├── strings.py # All user-facing strings, command descriptions, help text
|
||||||
|
├── member_sync.py # Role/nickname/birthday sync logic
|
||||||
|
├── sheets.py # Google Sheets read/write + in-memory cache
|
||||||
|
├── config.py # Environment variable loader
|
||||||
|
├── requirements.txt # Python dependencies
|
||||||
|
├── .env.example # Template for secrets
|
||||||
|
├── .env # Your secrets (gitignored)
|
||||||
|
├── credentials.json # Google service account key (gitignored)
|
||||||
|
├── docs/
|
||||||
|
│ ├── DEV_NOTES.md # Developer reference (architecture, checklists, constants)
|
||||||
|
│ ├── CHANGELOG.md # Version history
|
||||||
|
│ └── POCKETBASE_SETUP.md # PocketBase collection schema + setup instructions
|
||||||
|
├── scripts/
|
||||||
|
│ ├── migrate_to_pb.py # One-time migration: economy.json → PocketBase
|
||||||
|
│ └── add_stats_fields.py # Schema migration: add new fields to economy_users collection
|
||||||
|
├── data/
|
||||||
|
│ └── birthday_sent.json # Birthday dedup log (auto-created)
|
||||||
|
├── pb_data/ # PocketBase database files (auto-created, gitignored)
|
||||||
|
└── logs/
|
||||||
|
├── bot.log # General rotating log (auto-created)
|
||||||
|
└── transactions.log # Daily economy transaction log (auto-created)
|
||||||
|
```
|
||||||
16
config.py
Normal file
16
config.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||||
|
SHEET_ID = os.getenv("SHEET_ID")
|
||||||
|
GOOGLE_CREDS_PATH = os.getenv("GOOGLE_CREDS_PATH", "credentials.json")
|
||||||
|
GUILD_ID = int(os.getenv("GUILD_ID", "0"))
|
||||||
|
BIRTHDAY_CHANNEL_ID = int(os.getenv("BIRTHDAY_CHANNEL_ID", "0"))
|
||||||
|
BIRTHDAY_WINDOW_DAYS = int(os.getenv("BIRTHDAY_WINDOW_DAYS", "7"))
|
||||||
|
BASE_ROLE_IDS: list[int] = [1478304631930228779, 1478302278862766190]
|
||||||
|
|
||||||
|
PB_URL = os.getenv("PB_URL", "http://127.0.0.1:8090")
|
||||||
|
PB_ADMIN_EMAIL = os.getenv("PB_ADMIN_EMAIL", "")
|
||||||
|
PB_ADMIN_PASSWORD = os.getenv("PB_ADMIN_PASSWORD", "")
|
||||||
0
data/.gitkeep
Normal file
0
data/.gitkeep
Normal file
5
data/birthday_sent.json
Normal file
5
data/birthday_sent.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"2026-03-14": [
|
||||||
|
"650046190972305409"
|
||||||
|
]
|
||||||
|
}
|
||||||
5
data/bot_config.json
Normal file
5
data/bot_config.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"allowed_channels": [
|
||||||
|
"1482398641699291357"
|
||||||
|
]
|
||||||
|
}
|
||||||
904
docs/CHANGELOG.md
Normal file
904
docs/CHANGELOG.md
Normal file
@@ -0,0 +1,904 @@
|
|||||||
|
## v0.36.7
|
||||||
|
|
||||||
|
- Fixed high memory usage with large file uploads ([#7572](https://github.com/pocketbase/pocketbase/discussions/7572)).
|
||||||
|
|
||||||
|
- Updated the rate limiter reset rules to follow a more traditional fixed window strategy _(aka. to be more close to how it is presented in the UI - allow max X user requests under Ys)_ since several users complained that the older algorithm was not intuitive and not suitable for large intervals.
|
||||||
|
_Approximated sliding window strategy was also suggested as a better compromise option to help minimize traffic spikes right after reset but the additional tracking could introduce some overhead and for now it is left aside until we have more tests._
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.46.2 and SQLite 3.51.3.
|
||||||
|
_⚠️ SQLite 3.51.3 fixed a [database corruption bug](https://sqlite.org/wal.html#walresetbug) that is very unlikely to happen (with PocketBase even more so because we queue on app level all writes and explicit transactions through a single db connection), but still it is advised to upgrade._
|
||||||
|
|
||||||
|
- Updated other minor Go and npm deps.
|
||||||
|
_The min Go version in the go.mod of the package was also bumped to Go 1.25.0 because some of the newer dep versions require it._
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.6
|
||||||
|
|
||||||
|
- Set `NumberField.OnlyInt:true` for the generated View collection schema fields when a view column expression is known to return int-only values ([#7538](https://github.com/pocketbase/pocketbase/issues/7538)).
|
||||||
|
|
||||||
|
- Documented the `unmarshal` JSVM helper ([#7543](https://github.com/pocketbase/pocketbase/issues/7543)).
|
||||||
|
|
||||||
|
- Added extra read check after the `Store.GetOrSet` write lock to prevent races overwriting an already existing value.
|
||||||
|
|
||||||
|
- Added empty records check for the additional client-side filter's ListRule constraint that was introduced in v0.32.0 ([presentator#206](https://github.com/presentator/presentator/issues/206)).
|
||||||
|
|
||||||
|
- Set a fixed `routine.FireAndForget()` debug stack trace limit to 2KB.
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.26.1 because it comes with some [minor bug and security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.26.1).
|
||||||
|
|
||||||
|
- Typos and other minor doc fixes.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.5
|
||||||
|
|
||||||
|
- Disabled collection and fields name normalization while in IME mode ([#7532](https://github.com/pocketbase/pocketbase/pull/7532); thanks @miaopan607).
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.46.1 _(resets connection state on Tx.Commit failure)_.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.4
|
||||||
|
|
||||||
|
- Made the optional `Bearer` token prefix case-insensitive ([#7525](https://github.com/pocketbase/pocketbase/pull/7525); thanks @benjamesfleming).
|
||||||
|
|
||||||
|
- Enabled `$filesystem.s3(...)` and `$filesystem.local(...)` JSVM bindings ([#7526](https://github.com/pocketbase/pocketbase/issues/7526)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.3
|
||||||
|
|
||||||
|
- Added `Accept-Encoding: identity` to the S3 requests per the suggestion in [#7523](https://github.com/pocketbase/pocketbase/issues/7523).
|
||||||
|
_This should help fixing the 0-bytes file response when S3 API compression is enabled._
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.26.0 _(it comes with minor [GC performance improvements](https://go.dev/doc/go1.26#runtime))_.
|
||||||
|
|
||||||
|
- Other minor fixes _(updated `modernc.org/sqlite` to v1.45.0, updated `goja_nodejs` adding `Buffer.concat`, updated the arguments of `app.DeleteTable(...)`, `app.DeleteView(...)` and other similar methods to make it more clear that they are dangerous and shouldn't be used with untrusted input, etc.)_.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.2
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.44.3 _(race check fix)_, `goja` _(circular references fix)_ and other go deps.
|
||||||
|
|
||||||
|
- Other minor fixes _(updated tests to silence some of the race detector errors, updated `FindFirstRecordByData` with more clear error message when missing or invalid key is used, etc.)_.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.1
|
||||||
|
|
||||||
|
- Reverted the `DISTINCT` with `GROUP BY` replacement optimization from v0.36.0 as it was reported to negatively impact the indexes utilization for some queries
|
||||||
|
and the minor performance boost that you may get when used on large records is not enough to justify the more common use ([#7461](https://github.com/pocketbase/pocketbase/discussions/7461)).
|
||||||
|
_A better generic deduplication optimization for large records (aka. records with large `text`/`json` fields or many small ones) will be researched but there are no ETAs._
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.44.2 _(SQLite 3.51.2)_.
|
||||||
|
|
||||||
|
- Fixed code comment typos.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.36.0
|
||||||
|
|
||||||
|
- List query and API rules optimizations:
|
||||||
|
- Removed unnecessary correlated subquery expression when using back-relations via single `relation` field.
|
||||||
|
- Replaced `DISTINCT` with `GROUP BY id` when rows deduplication is needed and when deemed safe.
|
||||||
|
_This should help with having a more stable and predictable performance even if the collection records are on the larger side._
|
||||||
|
|
||||||
|
For some queries and data sets the above 2 optimizations have shown significant improvements but if you notice a performance degradation after upgrading,
|
||||||
|
please open a Q&A discussion with export of your collections structure and the problematic request so that it can be analyzed.
|
||||||
|
|
||||||
|
- Added [`strftime(format, timevalue, modifiers...)`](https://pocketbase.io/docs/api-rules-and-filters/#strftimeformat-time-value-modifiers-) date formatting filter and API rules function.
|
||||||
|
It works similarly to the [SQLite `strftime` builtin function](https://sqlite.org/lang_datefunc.html)
|
||||||
|
with the main difference that NULL results will be normalized for consistency with the non-nullable PocketBase `text` and `date` fields.
|
||||||
|
Multi-match expressions are also supported and works the same as if the collection field is referenced, for example:
|
||||||
|
```js
|
||||||
|
// requires ANY/AT-LEAST-ONE-OF multiRel records to have "created" date matching the formatted string "2026-01"
|
||||||
|
strftime('%Y-%m', multiRel.created) ?= '2026-01'
|
||||||
|
|
||||||
|
// requires ALL multiRel records to have "created" date matching the formatted string "2026-01"
|
||||||
|
strftime('%Y-%m', multiRel.created) = '2026-01'
|
||||||
|
```
|
||||||
|
|
||||||
|
- ⚠️ Minor changes to the `search.ResolverResult` struct _(mostly used internally)_:
|
||||||
|
- Replaced `NoCoalesce` field with the more explicit `NullFallback` _(`NullFallbackDisabled` is the same as `NoCoalesce:true`)_.
|
||||||
|
- Replaced the expression interface of the `MultiMatchSubQuery` field with the concrete struct type `search.MultiMatchSubquery` to avoid excessive type assertions and allow direct mutations of the field.
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.44.1 _(SQLite 3.51.1)_.
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.25.6 because it comes with some [minor security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.25.6).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.35.1
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to v1.43.0 _(query cancellation race fix)_.
|
||||||
|
|
||||||
|
- Other minor UI fixes (normalized relations picker selection and confirmation message when `maxSelect=0/1`, updated node deps).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.35.0
|
||||||
|
|
||||||
|
- Added `nullString()`, `nullInt()`, `nullFloat()`, `nullBool`, `nullArray()`, `nullObject()` JSVM helpers for scanning nullable columns ([#7396](https://github.com/pocketbase/pocketbase/issues/7396)).
|
||||||
|
|
||||||
|
- Store the correct `image/png` as attrs content type when generating a thumb fallback _(e.g. for `webp`)_.
|
||||||
|
|
||||||
|
- Trimmed custom uploaded file name and extension from leftover `.` characters after `filesystem.File` normalization.
|
||||||
|
_This was done to prevent issues with external files sync programs that may have special handling for "invisible" files._
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` _(v1.41.0 includes prepared statements optimization)_ and other minor Go deps.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.34.2
|
||||||
|
|
||||||
|
- Bumped JS SDK to v0.26.5 to fix Safari AbortError detection introduced with the previous release ([#7369](https://github.com/pocketbase/pocketbase/issues/7369)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.34.1
|
||||||
|
|
||||||
|
- Added missing `:` char to the autocomplete regex ([#7353](https://github.com/pocketbase/pocketbase/pull/7353); thanks @ouvreboite).
|
||||||
|
|
||||||
|
- Added "Copy raw JSON" collection dropdown option ([#7357](https://github.com/pocketbase/pocketbase/issues/7357)).
|
||||||
|
|
||||||
|
- Updated Go deps and JS SDK.
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.25.5 because it comes with some [minor security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.25.5).
|
||||||
|
_The runner action was also updated to `actions/setup-go@v6` since the previous v5 Go source seems [no longer accessible](https://github.com/actions/setup-go/pull/665#issuecomment-3416693714)._
|
||||||
|
|
||||||
|
|
||||||
|
## v0.34.0
|
||||||
|
|
||||||
|
- Added `@request.body.someField:changed` modifier.
|
||||||
|
It could be used when you want to ensure that a body field either wasn't submitted or was submitted with the same value.
|
||||||
|
Or in other words, if you want to disallow a field change the below 2 expressions would be equivalent:
|
||||||
|
```js
|
||||||
|
// (old)
|
||||||
|
(@request.body.someField:isset = false || @request.body.someField = someField)
|
||||||
|
|
||||||
|
// (new)
|
||||||
|
@request.body.someField:changed = false
|
||||||
|
```
|
||||||
|
|
||||||
|
- Added `MailerRecordEvent.Meta["info"]` property for the `OnMailerRecordAuthAlertSend` hook.
|
||||||
|
|
||||||
|
- Updated the backup restore popup with a short info about the performed restore steps.
|
||||||
|
|
||||||
|
- Updated Go deps.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.33.0
|
||||||
|
|
||||||
|
- Added extra `id` characters validation in addition to the user specified regex pattern ([#7312](https://github.com/pocketbase/pocketbase/issues/7312)).
|
||||||
|
_The following special characters are always forbidden: `./\|"'``<>:?*%$\n\r\t\0 `. Common reserved Windows file names such as `aux`, `prn`, `con`, `nul`, `com1-9`, `lpt1-9` are also not allowed._
|
||||||
|
_The list is not exhaustive but it should help minimizing eventual filesystem compatibility issues in case of wildcards or other loose regex patterns._
|
||||||
|
|
||||||
|
- Added `{ALERT_INFO}` placeholder to the auth alert mail template ([#7314](https://github.com/pocketbase/pocketbase/issues/7314)).
|
||||||
|
_⚠️ `mails.SendRecordAuthAlert(app, authRecord, info)` also now accepts a 3rd `info` string argument._
|
||||||
|
|
||||||
|
- Updated Go deps.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.32.0
|
||||||
|
|
||||||
|
- ⚠️ Added extra List/Search API rules checks for the client-side `filter`/`sort` relations.
|
||||||
|
|
||||||
|
This is continuation of the effort to eliminate the risk of information disclosure _(and eventually the side-channel attacks that may originate from that)_.
|
||||||
|
|
||||||
|
So far this was accepted tradeoff between performance, usability and correctness since the solutions at the time weren't really practical _(especially with the back-relations as mentioned in ["Security and performance" section in #4417](https://github.com/pocketbase/pocketbase/discussions/4417))_, but with v0.23+ changes we can implement the extra checks without littering the code too much, with very little impact on the performance and at the same time ensuring better out of the box security _(especially for the cases where users operate with sensitive fields like "code", "token", "secret", etc.)_.
|
||||||
|
|
||||||
|
Similar to the previous release, probably for most users with already configured API rules this change won't be breaking, but if you have an _intermediate/junction collection_ that is "locked" (superusers-only) we no longer will allow the client-side relation filter to pass through it and you'll have to set its List/Search API rule to enable the current user to search in it.
|
||||||
|
|
||||||
|
For example, if you have a client-side filter that targets `rel1.rel2.token`, the client must have not only List/Search API rule access to the main collection BUT also to the collections referenced by "rel1" and "rel2" relation fields.
|
||||||
|
|
||||||
|
Note that this change is only for the **client-side** `filter`/`sort` and doesn't affect the execution of superuser requests, API rules and `expand` - they continue to work the same as it is.
|
||||||
|
|
||||||
|
An optional environment variable to toggle this behavior was considered but for now I think having 2 ways of resolving client-side filters would introduce maintenance burden and can even cause confusion (this change should actually make things more intuitive and clear because we can simply say something like _"you can search by a collection X field only if you have List/Search API rule access to it"_ no matter whether the targeted collection is the request's main collection, the first or last relation from the filter chain, etc.).
|
||||||
|
|
||||||
|
If you stumble on an error or extreme query performance degradation as a result of the extra checks, please open a Q&A discussion with the failing request and export of your collections configuration as JSON (_Settings > Export collections_) and I'll try to investigate it.
|
||||||
|
|
||||||
|
- Increased the default SQLite `PRAGMA cache_size` to ~32MB.
|
||||||
|
|
||||||
|
- Fixed deadlock when manually triggering the `OnTerminate` hook ([#7305](https://github.com/pocketbase/pocketbase/pull/7305); thanks @yerTools).
|
||||||
|
|
||||||
|
- Fixed some code comment typos, regenerated the JSVM types and updated npm dependencies.
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.40.0.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.31.0
|
||||||
|
|
||||||
|
- Visualize presentable multiple `relation` fields ([#7260](https://github.com/pocketbase/pocketbase/issues/7260)).
|
||||||
|
|
||||||
|
- Support Ed25519 in the optional OIDC `id_token` signature validation ([#7252](https://github.com/pocketbase/pocketbase/issues/7252); thanks @shynome).
|
||||||
|
|
||||||
|
- Added `ApiScenario.DisableTestAppCleanup` optional field to skip the auto test app cleanup and leave it up to the developers to do the cleanup manually ([#7267](https://github.com/pocketbase/pocketbase/discussions/7267)).
|
||||||
|
|
||||||
|
- Added `FileDownloadRequestEvent.ThumbError` field that is populated in case of a thumb generation failure (e.g. unsupported format, timing out, etc.), allowing developers to reject the thumb fallback and/or supply their own custom thumb generation ([#7268](https://github.com/pocketbase/pocketbase/discussions/7268)).
|
||||||
|
|
||||||
|
- ⚠️ Disallow client-side filtering and sorting of relations where the collection of the last targeted relation field has superusers-only List/Search API rule to further minimize the risk of eventual side-channel attack.
|
||||||
|
_This should be a non-breaking change for most users, but if you want the old behavior, please open a new Q&A discussion with details about your use case to evaluate making it configurable._
|
||||||
|
_Note also that as mentioned in the "Security and performance" section of [#4417](https://github.com/pocketbase/pocketbase/discussions/4417) and [#5863](https://github.com/pocketbase/pocketbase/discussions/5863), the easiest and recommended solution to protect security sensitive fields (tokens, codes, passwords, etc.) is to mark them as "Hidden" (aka. make them non-API filterable)._
|
||||||
|
|
||||||
|
- Regenerated JSVM types and updated npm and Go deps.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.30.4
|
||||||
|
|
||||||
|
- Fixed `json` field CSS regression introduced with the overflow workaround in v0.30.3 ([#7259](https://github.com/pocketbase/pocketbase/issues/7259)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.30.3
|
||||||
|
|
||||||
|
- Fixed legacy identitity field priority check when a username is a valid email address ([#7256](https://github.com/pocketbase/pocketbase/issues/7256)).
|
||||||
|
|
||||||
|
- Workaround autocomplete overflow issue with Firefox 144 ([#7223](https://github.com/pocketbase/pocketbase/issues/7223)).
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.39.1 (SQLite 3.50.4).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.30.2
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.24.8 since it comes with some [minor security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.24.8+label%3ACherryPickApproved).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.30.1
|
||||||
|
|
||||||
|
- ⚠️ Excluded the `lost+found` directory from the backups ([#7208](https://github.com/pocketbase/pocketbase/pull/7208); thanks @lbndev).
|
||||||
|
_If for some reason you want to keep it, you can restore it by editing the `e.Exclude` list of the `OnBackupCreate` and `OnBackupRestore` hooks._
|
||||||
|
|
||||||
|
- Minor tests improvements (disabled initial superuser creation for the test app to avoid cluttering the std output, added more tests for the `s3.Uploader.MaxConcurrency`, etc.).
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` and other Go dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.30.0
|
||||||
|
|
||||||
|
- Eagerly escape the S3 request path following the same rules as in the S3 signing header ([#7153](https://github.com/pocketbase/pocketbase/issues/7153)).
|
||||||
|
|
||||||
|
- Added Lark OAuth2 provider ([#7130](https://github.com/pocketbase/pocketbase/pull/7130); thanks @mashizora).
|
||||||
|
|
||||||
|
- Increased test tokens `exp` claim to minimize eventual issues with reproducible builds ([#7123](https://github.com/pocketbase/pocketbase/issues/7123)).
|
||||||
|
|
||||||
|
- Added `os.Root` bindings to the JSVM ([`$os.openRoot`](https://pocketbase.io/jsvm/functions/_os.openRoot.html), [`$os.openInRoot`](https://pocketbase.io/jsvm/functions/_os.openInRoot.html)).
|
||||||
|
|
||||||
|
- Added `osutils.IsProbablyGoRun()` helper to loosely check if the program was started using `go run`.
|
||||||
|
|
||||||
|
- Various minor UI improvements (updated collections indexes UI, enabled seconds in the datepicker, updated helper texts, etc.).
|
||||||
|
|
||||||
|
- ⚠️ Updated the minimum package Go version to 1.24.0 and bumped Go dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.29.3
|
||||||
|
|
||||||
|
- Try to forward Apple OAuth2 POST redirect user's name so that it can be returned (and eventually assigned) with the success response of the all-in-one auth call ([#7090](https://github.com/pocketbase/pocketbase/issues/7090)).
|
||||||
|
|
||||||
|
- Fixed `RateLimitRule.Audience` code comment ([#7098](https://github.com/pocketbase/pocketbase/pull/7098); thanks @iustin05).
|
||||||
|
|
||||||
|
- Mocked `syscall.Exec` when building for WASM ([#7116](https://github.com/pocketbase/pocketbase/pull/7116); thanks @joas8211).
|
||||||
|
_Note that WASM is not officially supported PocketBase build target and many things may not work as expected._
|
||||||
|
|
||||||
|
- Registered missing `$filesystem`, `$mails`, `$template` and `__hooks` bindings in the JSVM migrations ([#7125](https://github.com/pocketbase/pocketbase/issues/7125)).
|
||||||
|
|
||||||
|
- Regenerated JSVM types to include methods from structs with single generic parameter.
|
||||||
|
|
||||||
|
- Updated Go dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.29.2
|
||||||
|
|
||||||
|
- Bumped min Go GitHub action version to 1.23.12 since it comes with some [minor fixes for the runtime and `database/sql` package](https://github.com/golang/go/issues?q=milestone%3AGo1.23.12+label%3ACherryPickApproved).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.29.1
|
||||||
|
|
||||||
|
- Updated the X/Twitter provider to return the `confirmed_email` field and to use the `x.com` domain ([#7035](https://github.com/pocketbase/pocketbase/issues/7035)).
|
||||||
|
|
||||||
|
- Added Box.com OAuth2 provider ([#7056](https://github.com/pocketbase/pocketbase/pull/7056); thanks @blakepatteson).
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.38.2 (SQLite 3.50.3).
|
||||||
|
|
||||||
|
- Fixed example List API response ([#7049](https://github.com/pocketbase/pocketbase/pull/7049); thanks @williamtguerra).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.29.0
|
||||||
|
|
||||||
|
- Enabled calling the `/auth-refresh` endpoint with nonrenewable tokens.
|
||||||
|
_When used with nonrenewable tokens (e.g. impersonate) the endpoint will simply return the same token with the up-to-date user data associated with it._
|
||||||
|
|
||||||
|
- Added the triggered rate rimit rule in the error log `details`.
|
||||||
|
|
||||||
|
- Added optional `ServeEvent.Listener` field to initialize a custom network listener (e.g. `unix`) instead of the default `tcp` ([#3233](https://github.com/pocketbase/pocketbase/discussions/3233)).
|
||||||
|
|
||||||
|
- Fixed request data unmarshalization for the `DynamicModel` array/object fields ([#7022](https://github.com/pocketbase/pocketbase/discussions/7022)).
|
||||||
|
|
||||||
|
- Fixed Dashboard page title `-` escaping ([#6982](https://github.com/pocketbase/pocketbase/issues/6982)).
|
||||||
|
|
||||||
|
- Other minor improvements (updated first superuser console text when running with `go run`, clarified trusted IP proxy header label, wrapped the backup restore in a transaction as an extra precaution, updated deps, etc.).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.28.4
|
||||||
|
|
||||||
|
- Added global JSVM `toBytes()` helper to return the bytes slice representation of a value such as io.Reader or string, _other types are first serialized to Go string_ ([#6935](https://github.com/pocketbase/pocketbase/issues/6935)).
|
||||||
|
|
||||||
|
- Fixed `security.RandomStringByRegex` random distribution ([#6947](https://github.com/pocketbase/pocketbase/pull/6947); thanks @yerTools).
|
||||||
|
|
||||||
|
- Minor docs and typos fixes.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.28.3
|
||||||
|
|
||||||
|
- Skip sending empty `Range` header when fetching blobs from S3 ([#6914](https://github.com/pocketbase/pocketbase/pull/6914)).
|
||||||
|
|
||||||
|
- Updated Go deps and particularly `modernc.org/sqlite` to 1.38.0 (SQLite 3.50.1).
|
||||||
|
|
||||||
|
- Bumped GitHub action min Go version to 1.23.10 as it comes with some [minor security `net/http` fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.23.10+label%3ACherryPickApproved).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.28.2
|
||||||
|
|
||||||
|
- Loaded latin-ext charset for the default text fonts ([#6869](https://github.com/pocketbase/pocketbase/issues/6869)).
|
||||||
|
|
||||||
|
- Updated view query CAST regex to properly recognize multiline expressions ([#6860](https://github.com/pocketbase/pocketbase/pull/6860); thanks @azat-ismagilov).
|
||||||
|
|
||||||
|
- Updated Go and npm dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.28.1
|
||||||
|
|
||||||
|
- Fixed `json_each`/`json_array_length` normalizations to properly check for array values ([#6835](https://github.com/pocketbase/pocketbase/issues/6835)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.28.0
|
||||||
|
|
||||||
|
- Write the default response body of `*Request` hooks that are wrapped in a transaction after the related transaction completes to allow propagating the transaction error ([#6462](https://github.com/pocketbase/pocketbase/discussions/6462#discussioncomment-12207818)).
|
||||||
|
|
||||||
|
- Updated `app.DB()` to automatically routes raw write SQL statements to the nonconcurrent db pool ([#6689](https://github.com/pocketbase/pocketbase/discussions/6689)).
|
||||||
|
_For the rare cases when it is needed users still have the option to explicitly target the specific pool they want using `app.ConcurrentDB()`/`app.NonconcurrentDB()`._
|
||||||
|
|
||||||
|
- ⚠️ Changed the default `json` field max size to 1MB.
|
||||||
|
_Users still have the option to adjust the default limit from the collection field options but keep in mind that storing large strings/blobs in the database is known to cause performance issues and should be avoided when possible._
|
||||||
|
|
||||||
|
- ⚠️ Soft-deprecated and replaced `filesystem.System.GetFile(fileKey)` with `filesystem.System.GetReader(fileKey)` to avoid the confusion with `filesystem.File`.
|
||||||
|
_The old method will still continue to work for at least until v0.29.0 but you'll get a console warning to replace it with `GetReader`._
|
||||||
|
|
||||||
|
- Added new `filesystem.System.GetReuploadableFile(fileKey, preserveName)` method to return an existing blob as a `*filesystem.File` value ([#6792](https://github.com/pocketbase/pocketbase/discussions/6792)).
|
||||||
|
_This method could be useful in case you want to clone an existing Record file and assign it to a new Record (e.g. in a Record duplicate action)._
|
||||||
|
|
||||||
|
- Other minor improvements (updated the GitHub release min Go version to 1.23.9, updated npm and Go deps, etc.)
|
||||||
|
|
||||||
|
|
||||||
|
## v0.27.2
|
||||||
|
|
||||||
|
- Added workers pool when cascade deleting record files to minimize _"thread exhaustion"_ errors ([#6780](https://github.com/pocketbase/pocketbase/discussions/6780)).
|
||||||
|
|
||||||
|
- Updated the `:excerpt` fields modifier to properly account for multibyte characters ([#6778](https://github.com/pocketbase/pocketbase/issues/6778)).
|
||||||
|
|
||||||
|
- Use `rowid` as count column for non-view collections to minimize the need of having the id field in a covering index ([#6739](https://github.com/pocketbase/pocketbase/discussions/6739))
|
||||||
|
|
||||||
|
|
||||||
|
## v0.27.1
|
||||||
|
|
||||||
|
- Updated example `geoPoint` API preview body data.
|
||||||
|
|
||||||
|
- Added JSVM `new GeoPointField({ ... })` constructor.
|
||||||
|
|
||||||
|
- Added _partial_ WebP thumbs generation (_the thumbs will be stored as PNG_; [#6744](https://github.com/pocketbase/pocketbase/pull/6744)).
|
||||||
|
|
||||||
|
- Updated npm dev dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.27.0
|
||||||
|
|
||||||
|
- ⚠️ Moved the Create and Manage API rule checks out of the `OnRecordCreateRequest` hook finalizer, **aka. now all CRUD API rules are checked BEFORE triggering their corresponding `*Request` hook**.
|
||||||
|
This was done to minimize the confusion regarding the firing order of the request operations, making it more predictable and consistent with the other record List/View/Update/Delete request actions.
|
||||||
|
It could be a minor breaking change if you are relying on the old behavior and have a Go `tests.ApiScenario` that is testing a Create API rule failure and expect `OnRecordCreateRequest` to be fired. In that case for example you may have to update your test scenario like:
|
||||||
|
```go
|
||||||
|
tests.ApiScenario{
|
||||||
|
Name: "Example test that checks a Create API rule failure"
|
||||||
|
Method: http.MethodPost,
|
||||||
|
URL: "/api/collections/example/records",
|
||||||
|
...
|
||||||
|
// old:
|
||||||
|
ExpectedEvents: map[string]int{
|
||||||
|
"*": 0,
|
||||||
|
"OnRecordCreateRequest": 1,
|
||||||
|
},
|
||||||
|
// new:
|
||||||
|
ExpectedEvents: map[string]int{"*": 0},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
If you are having difficulties adjusting your code, feel free to open a [Q&A discussion](https://github.com/pocketbase/pocketbase/discussions) with the failing/problematic code sample.
|
||||||
|
|
||||||
|
- Added [new `geoPoint` field](https://pocketbase.io/docs/collections/#geopoint) for storing `{"lon":x,"lat":y}` geographic coordinates.
|
||||||
|
In addition, a new [`geoDistance(lonA, lotA, lonB, lotB)` function](https://pocketbase.io/docs/api-rules-and-filters/#geodistancelona-lata-lonb-latb) was also implemented that could be used to apply an API rule or filter constraint based on the distance (in km) between 2 geo points.
|
||||||
|
|
||||||
|
- Updated the `select` field UI to accommodate better larger lists and RTL languages ([#4674](https://github.com/pocketbase/pocketbase/issues/4674)).
|
||||||
|
|
||||||
|
- Updated the mail attachments auto MIME type detection to use `gabriel-vasile/mimetype` for consistency and broader sniffing signatures support.
|
||||||
|
|
||||||
|
- Forced `text/javascript` Content-Type when serving `.js`/`.mjs` collection uploaded files with the `/api/files/...` endpoint ([#6597](https://github.com/pocketbase/pocketbase/issues/6597)).
|
||||||
|
|
||||||
|
- Added second optional JSVM `DateTime` constructor argument for specifying a default timezone as TZ identifier when parsing the date string as alternative to a fixed offset in order to better handle daylight saving time nuances ([#6688](https://github.com/pocketbase/pocketbase/discussions/6688)):
|
||||||
|
```js
|
||||||
|
// the same as with CET offset: new DateTime("2025-10-26 03:00:00 +01:00")
|
||||||
|
new DateTime("2025-10-26 03:00:00", "Europe/Amsterdam") // 2025-10-26 02:00:00.000Z
|
||||||
|
|
||||||
|
// the same as with CEST offset: new DateTime("2025-10-26 01:00:00 +02:00")
|
||||||
|
new DateTime("2025-10-26 01:00:00", "Europe/Amsterdam") // 2025-10-25 23:00:00.000Z
|
||||||
|
```
|
||||||
|
|
||||||
|
- Soft-deprecated the `$http.send`'s `result.raw` field in favor of `result.body` that contains the response body as plain bytes slice to avoid the discrepancies between Go and the JSVM when casting binary data to string.
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.37.0.
|
||||||
|
|
||||||
|
- Other minor improvements (_removed the superuser fields from the auth record create/update body examples, allowed programmatically updating the auth record password from the create/update hooks, fixed collections import error response, etc._).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.6
|
||||||
|
|
||||||
|
- Allow OIDC `email_verified` to be int or boolean string since some OIDC providers like AWS Cognito has non-standard userinfo response ([#6657](https://github.com/pocketbase/pocketbase/pull/6657)).
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.36.3.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.5
|
||||||
|
|
||||||
|
- Fixed canonical URI parts escaping when generating the S3 request signature ([#6654](https://github.com/pocketbase/pocketbase/issues/6654)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.4
|
||||||
|
|
||||||
|
- Fixed `RecordErrorEvent.Error` and `CollectionErrorEvent.Error` sync with `ModelErrorEvent.Error` ([#6639](https://github.com/pocketbase/pocketbase/issues/6639)).
|
||||||
|
|
||||||
|
- Fixed logs details copy to clipboard action.
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` to 1.36.2.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.3
|
||||||
|
|
||||||
|
- Fixed and normalized logs error serialization across common types for more consistent logs error output ([#6631](https://github.com/pocketbase/pocketbase/issues/6631)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.2
|
||||||
|
|
||||||
|
- Updated `golang-jwt/jwt` dependency because it comes with a [minor security fix](https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.1
|
||||||
|
|
||||||
|
- Removed the wrapping of `io.EOF` error when reading files since currently `io.ReadAll` doesn't check for wrapped errors ([#6600](https://github.com/pocketbase/pocketbase/issues/6600)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.26.0
|
||||||
|
|
||||||
|
- ⚠️ Replaced `aws-sdk-go-v2` and `gocloud.dev/blob` with custom lighter implementation ([#6562](https://github.com/pocketbase/pocketbase/discussions/6562)).
|
||||||
|
As a side-effect of the dependency removal, the binary size has been reduced with ~10MB and builds ~30% faster.
|
||||||
|
_Although the change is expected to be backward-compatible, I'd recommend to test first locally the new version with your S3 provider (if you use S3 for files storage and backups)._
|
||||||
|
|
||||||
|
- ⚠️ Prioritized the user submitted non-empty `createData.email` (_it will be unverified_) when creating the PocketBase user during the first OAuth2 auth.
|
||||||
|
|
||||||
|
- Load the request info context during password/OAuth2/OTP authentication ([#6402](https://github.com/pocketbase/pocketbase/issues/6402)).
|
||||||
|
This could be useful in case you want to target the auth method as part of the MFA and Auth API rules.
|
||||||
|
For example, to disable MFA for the OAuth2 auth could be expressed as `@request.context != "oauth2"` MFA rule.
|
||||||
|
|
||||||
|
- Added `store.Store.SetFunc(key, func(old T) new T)` to set/update a store value with the return result of the callback in a concurrent safe manner.
|
||||||
|
|
||||||
|
- Added `subscription.Message.WriteSSE(w, id)` for writing an SSE formatted message into the provided writer interface (_used mostly to assist with the unit testing_).
|
||||||
|
|
||||||
|
- Added `$os.stat(file)` JSVM helper ([#6407](https://github.com/pocketbase/pocketbase/discussions/6407)).
|
||||||
|
|
||||||
|
- Added log warning for `async` marked JSVM handlers and resolve when possible the returned `Promise` as fallback ([#6476](https://github.com/pocketbase/pocketbase/issues/6476)).
|
||||||
|
|
||||||
|
- Allowed calling `cronAdd`, `cronRemove` from inside other JSVM handlers ([#6481](https://github.com/pocketbase/pocketbase/discussions/6481)).
|
||||||
|
|
||||||
|
- Bumped the default request read and write timeouts to 5mins (_old 3mins_) to accommodate slower internet connections and larger file uploads/downloads.
|
||||||
|
_If you want to change them you can modify the `OnServe` hook's `ServeEvent.ReadTimeout/WriteTimeout` fields as shown in [#6550](https://github.com/pocketbase/pocketbase/discussions/6550#discussioncomment-12364515)._
|
||||||
|
|
||||||
|
- Normalized the `@request.auth.*` and `@request.body.*` back relations resolver to always return `null` when the relation field is pointing to a different collection ([#6590](https://github.com/pocketbase/pocketbase/discussions/6590#discussioncomment-12496581)).
|
||||||
|
|
||||||
|
- Other minor improvements (_fixed query dev log nested parameters output, reintroduced `DynamicModel` object/array props reflect types caching, updated Go and npm deps, etc._)
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.9
|
||||||
|
|
||||||
|
- Fixed `DynamicModel` object/array props reflect type caching ([#6563](https://github.com/pocketbase/pocketbase/discussions/6563)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.8
|
||||||
|
|
||||||
|
- Added a default leeway of 5 minutes for the Apple/OIDC `id_token` timestamp claims check to account for clock-skew ([#6529](https://github.com/pocketbase/pocketbase/issues/6529)).
|
||||||
|
It can be further customized if needed with the `PB_ID_TOKEN_LEEWAY` env variable (_the value must be in seconds, e.g. "PB_ID_TOKEN_LEEWAY=60" for 1 minute_).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.7
|
||||||
|
|
||||||
|
- Fixed `@request.body.jsonObjOrArr.*` values extraction ([#6493](https://github.com/pocketbase/pocketbase/discussions/6493)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.6
|
||||||
|
|
||||||
|
- Restore the missing `meta.isNew` field of the OAuth2 success response ([#6490](https://github.com/pocketbase/pocketbase/issues/6490)).
|
||||||
|
|
||||||
|
- Updated npm dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.5
|
||||||
|
|
||||||
|
- Set the current working directory as a default goja script path when executing inline JS strings to allow `require(m)` traversing parent `node_modules` directories.
|
||||||
|
|
||||||
|
- Updated `modernc.org/sqlite` and `modernc.org/libc` dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.4
|
||||||
|
|
||||||
|
- Downgraded `aws-sdk-go-v2` to the version before the default data integrity checks because there have been reports for non-AWS S3 providers in addition to Backblaze (IDrive, R2) that no longer or partially work with the latest AWS SDK changes.
|
||||||
|
|
||||||
|
While we try to enforce `when_required` by default, it is not enough to disable the new AWS SDK integrity checks entirely and some providers will require additional manual adjustments to make them compatible with the latest AWS SDK (e.g. removing the `x-aws-checksum-*` headers, unsetting the checksums calculation or reinstantiating the old MD5 checksums for some of the required operations, etc.) which as a result leads to a configuration mess that I'm not sure it would be a good idea to introduce.
|
||||||
|
|
||||||
|
This unfornuatelly is not a PocketBase or Go specific issue and the official AWS SDKs for other languages are in the same situation (even the latest aws-cli).
|
||||||
|
|
||||||
|
For those of you that extend PocketBase with Go: if your S3 vendor doesn't support the [AWS Data integrity checks](https://docs.aws.amazon.com/sdkref/latest/guide/feature-dataintegrity.html) and you are updating with `go get -u`, then make sure that the `aws-sdk-go-v2` dependencies in your `go.mod` are the same as in the repo:
|
||||||
|
```
|
||||||
|
// go.mod
|
||||||
|
github.com/aws/aws-sdk-go-v2 v1.36.1
|
||||||
|
github.com/aws/aws-sdk-go-v2/config v1.28.10
|
||||||
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.51
|
||||||
|
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.48
|
||||||
|
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.2
|
||||||
|
|
||||||
|
// after that run
|
||||||
|
go clean -modcache && go mod tidy
|
||||||
|
```
|
||||||
|
_The versions pinning is temporary until the non-AWS S3 vendors patch their implementation or until I manage to find time to remove/replace the `aws-sdk-go-v2` dependency (I'll consider prioritizing it for the v0.26 or v0.27 release)._
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.3
|
||||||
|
|
||||||
|
- Added a temporary exception for Backblaze S3 endpoints to exclude the new `aws-sdk-go-v2` checksum headers ([#6440](https://github.com/pocketbase/pocketbase/discussions/6440)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.2
|
||||||
|
|
||||||
|
- Fixed realtime delete event not being fired for `RecordProxy`-ies and added basic realtime record resolve automated tests ([#6433](https://github.com/pocketbase/pocketbase/issues/6433)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.1
|
||||||
|
|
||||||
|
- Fixed the batch API Preview success sample response.
|
||||||
|
|
||||||
|
- Bumped GitHub action min Go version to 1.23.6 as it comes with a [minor security fix](https://github.com/golang/go/issues?q=milestone%3AGo1.23.6+label%3ACherryPickApproved) for the ppc64le build.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.25.0
|
||||||
|
|
||||||
|
- ⚠️ Upgraded Google OAuth2 auth, token and userinfo endpoints to their latest versions.
|
||||||
|
_For users that don't do anything custom with the Google OAuth2 data or the OAuth2 auth URL, this should be a non-breaking change. The exceptions that I could find are:_
|
||||||
|
- `/v3/userinfo` auth response changes:
|
||||||
|
```
|
||||||
|
meta.rawUser.id => meta.rawUser.sub
|
||||||
|
meta.rawUser.verified_email => meta.rawUser.email_verified
|
||||||
|
```
|
||||||
|
- `/v2/auth` query parameters changes:
|
||||||
|
If you are specifying custom `approval_prompt=force` query parameter for the OAuth2 auth URL, you'll have to replace it with **`prompt=consent`**.
|
||||||
|
|
||||||
|
- Added Trakt OAuth2 provider ([#6338](https://github.com/pocketbase/pocketbase/pull/6338); thanks @aidan-)
|
||||||
|
|
||||||
|
- Added support for case-insensitive password auth based on the related UNIQUE index field collation ([#6337](https://github.com/pocketbase/pocketbase/discussions/6337)).
|
||||||
|
|
||||||
|
- Enforced `when_required` for the new AWS SDK request and response checksum validations to allow other non-AWS vendors to catch up with new AWS SDK changes (see [#6313](https://github.com/pocketbase/pocketbase/discussions/6313) and [aws/aws-sdk-go-v2#2960](https://github.com/aws/aws-sdk-go-v2/discussions/2960)).
|
||||||
|
_You can set the environment variables `AWS_REQUEST_CHECKSUM_CALCULATION` and `AWS_RESPONSE_CHECKSUM_VALIDATION` to `when_supported` if your S3 vendor supports the [new default integrity protections](https://docs.aws.amazon.com/sdkref/latest/guide/feature-dataintegrity.html)._
|
||||||
|
|
||||||
|
- Soft-deprecated `Record.GetUploadedFiles` in favor of `Record.GetUnsavedFiles` to minimize the ambiguities what the method do ([#6269](https://github.com/pocketbase/pocketbase/discussions/6269)).
|
||||||
|
|
||||||
|
- Replaced archived `github.com/AlecAivazis/survey` dependency with a simpler `osutils.YesNoPrompt(message, fallback)` helper.
|
||||||
|
|
||||||
|
- Upgraded to `golang-jwt/jwt/v5`.
|
||||||
|
|
||||||
|
- Added JSVM `new Timezone(name)` binding for constructing `time.Location` value ([#6219](https://github.com/pocketbase/pocketbase/discussions/6219)).
|
||||||
|
|
||||||
|
- Added `inflector.Camelize(str)` and `inflector.Singularize(str)` helper methods.
|
||||||
|
|
||||||
|
- Use the non-transactional app instance during the realtime records delete access checks to ensure that cascade deleted records with API rules relying on the parent will be resolved.
|
||||||
|
|
||||||
|
- Other minor improvements (_replaced all `bool` exists db scans with `int` for broader drivers compatibility, updated API Preview sample error responses, updated UI dependencies, etc._)
|
||||||
|
|
||||||
|
|
||||||
|
## v0.24.4
|
||||||
|
|
||||||
|
- Fixed fields extraction for view query with nested comments ([#6309](https://github.com/pocketbase/pocketbase/discussions/6309)).
|
||||||
|
|
||||||
|
- Bumped GitHub action min Go version to 1.23.5 as it comes with some [minor security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.23.5).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.24.3
|
||||||
|
|
||||||
|
- Fixed incorrectly reported unique validator error for fields starting with name of another field ([#6281](https://github.com/pocketbase/pocketbase/pull/6281); thanks @svobol13).
|
||||||
|
|
||||||
|
- Reload the created/edited records data in the RecordsPicker UI.
|
||||||
|
|
||||||
|
- Updated Go dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.24.2
|
||||||
|
|
||||||
|
- Fixed display fields extraction when there are multiple "Presentable" `relation` fields in a single related collection ([#6229](https://github.com/pocketbase/pocketbase/issues/6229)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.24.1
|
||||||
|
|
||||||
|
- Added missing time macros in the UI autocomplete.
|
||||||
|
|
||||||
|
- Fixed JSVM types for structs and functions with multiple generic parameters.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.24.0
|
||||||
|
|
||||||
|
- ⚠️ Removed the "dry submit" when executing the collections Create API rule
|
||||||
|
(you can find more details why this change was introduced and how it could affect your app in https://github.com/pocketbase/pocketbase/discussions/6073).
|
||||||
|
For most users it should be non-breaking change, BUT if you have Create API rules that uses self-references or view counters you may have to adjust them manually.
|
||||||
|
With this change the "multi-match" operators are also normalized in case the targeted collection doesn't have any records
|
||||||
|
(_or in other words, `@collection.example.someField != "test"` will result to `true` if `example` collection has no records because it satisfies the condition that all available "example" records mustn't have `someField` equal to "test"_).
|
||||||
|
As a side-effect of all of the above minor changes, the record create API performance has been also improved ~4x times in high concurrent scenarios (500 concurrent clients inserting total of 50k records - [old (58.409064001s)](https://github.com/pocketbase/benchmarks/blob/54140be5fb0102f90034e1370c7f168fbcf0ddf0/results/hetzner_cax41_cgo.md#creating-50000-posts100k-reqs50000-conc500-rulerequestauthid----requestdatapublicisset--true) vs [new (13.580098262s)](https://github.com/pocketbase/benchmarks/blob/7df0466ac9bd62fe0a1056270d20ef82012f0234/results/hetzner_cax41_cgo.md#creating-50000-posts100k-reqs50000-conc500-rulerequestauthid----requestbodypublicisset--true)).
|
||||||
|
|
||||||
|
- ⚠️ Changed the type definition of `store.Store[T any]` to `store.Store[K comparable, T any]` to allow support for custom store key types.
|
||||||
|
For most users it should be non-breaking change, BUT if you are calling `store.New[any](nil)` instances you'll have to specify the store key type, aka. `store.New[string, any](nil)`.
|
||||||
|
|
||||||
|
- Added `@yesterday` and `@tomorrow` datetime filter macros.
|
||||||
|
|
||||||
|
- Added `:lower` filter modifier (e.g. `title:lower = "lorem"`).
|
||||||
|
|
||||||
|
- Added `mailer.Message.InlineAttachments` field for attaching inline files to an email (_aka. `cid` links_).
|
||||||
|
|
||||||
|
- Added cache for the JSVM `arrayOf(m)`, `DynamicModel`, etc. dynamic `reflect` created types.
|
||||||
|
|
||||||
|
- Added auth collection select for the settings "Send test email" popup ([#6166](https://github.com/pocketbase/pocketbase/issues/6166)).
|
||||||
|
|
||||||
|
- Added `record.SetRandomPassword()` to simplify random password generation usually used in the OAuth2 or OTP record creation flows.
|
||||||
|
_The generated ~30 chars random password is assigned directly as bcrypt hash and ignores the `password` field plain value validators like min/max length or regex pattern._
|
||||||
|
|
||||||
|
- Added option to list and trigger the registered app level cron jobs via the Web API and UI.
|
||||||
|
|
||||||
|
- Added extra validators for the collection field `int64` options (e.g. `FileField.MaxSize`) restricting them to the max safe JSON number (2^53-1).
|
||||||
|
|
||||||
|
- Added option to unset/overwrite the default PocketBase superuser installer using `ServeEvent.InstallerFunc`.
|
||||||
|
|
||||||
|
- Added `app.FindCachedCollectionReferences(collection, excludeIds)` to speedup records cascade delete almost twice for projects with many collections.
|
||||||
|
|
||||||
|
- Added `tests.NewTestAppWithConfig(config)` helper if you need more control over the test configurations like `IsDev`, the number of allowed connections, etc.
|
||||||
|
|
||||||
|
- Invalidate all record tokens when the auth record email is changed programmatically or by a superuser ([#5964](https://github.com/pocketbase/pocketbase/issues/5964)).
|
||||||
|
|
||||||
|
- Eagerly interrupt waiting for the email alert send in case it takes longer than 15s.
|
||||||
|
|
||||||
|
- Normalized the hidden fields filter checks and allow targetting hidden fields in the List API rule.
|
||||||
|
|
||||||
|
- Fixed "Unique identify fields" input not refreshing on unique indexes change ([#6184](https://github.com/pocketbase/pocketbase/issues/6184)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.12
|
||||||
|
|
||||||
|
- Added warning logs in case of mismatched `modernc.org/sqlite` and `modernc.org/libc` versions ([#6136](https://github.com/pocketbase/pocketbase/issues/6136#issuecomment-2556336962)).
|
||||||
|
|
||||||
|
- Skipped the default body size limit middleware for the backup upload endpoint ([#6152](https://github.com/pocketbase/pocketbase/issues/6152)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.11
|
||||||
|
|
||||||
|
- Upgraded `golang.org/x/net` to 0.33.0 to fix [CVE-2024-45338](https://www.cve.org/CVERecord?id=CVE-2024-45338).
|
||||||
|
_PocketBase uses the vulnerable functions primarily for the auto html->text mail generation, but most applications shouldn't be affected unless you are manually embedding unrestricted user provided value in your mail templates._
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.10
|
||||||
|
|
||||||
|
- Renew the superuser file token cache when clicking on the thumb preview or download link ([#6137](https://github.com/pocketbase/pocketbase/discussions/6137)).
|
||||||
|
|
||||||
|
- Upgraded `modernc.org/sqlite` to 1.34.3 to fix "disk io" error on arm64 systems.
|
||||||
|
_If you are extending PocketBase with Go and upgrading with `go get -u` make sure to manually set in your go.mod the `modernc.org/libc` indirect dependency to v1.55.3, aka. the exact same version the driver is using._
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.9
|
||||||
|
|
||||||
|
- Replaced `strconv.Itoa` with `strconv.FormatInt` to avoid the int64->int conversion overflow on 32-bit platforms ([#6132](https://github.com/pocketbase/pocketbase/discussions/6132)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.8
|
||||||
|
|
||||||
|
- Fixed Model->Record and Model->Collection hook events sync for nested and/or inner-hook transactions ([#6122](https://github.com/pocketbase/pocketbase/discussions/6122)).
|
||||||
|
|
||||||
|
- Other minor improvements (updated Go and npm deps, added extra escaping for the default mail record params in case the emails are stored as html files, fixed code comment typos, etc.).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.7
|
||||||
|
|
||||||
|
- Fixed JSVM exception -> Go error unwrapping when throwing errors from non-request hooks ([#6102](https://github.com/pocketbase/pocketbase/discussions/6102)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.6
|
||||||
|
|
||||||
|
- Fixed `$filesystem.fileFromURL` documentation and generated type ([#6058](https://github.com/pocketbase/pocketbase/issues/6058)).
|
||||||
|
|
||||||
|
- Fixed `X-Forwarded-For` header typo in the suggested UI "Common trusted proxy" headers ([#6063](https://github.com/pocketbase/pocketbase/pull/6063)).
|
||||||
|
|
||||||
|
- Updated the `text` field max length validator error message to make it more clear ([#6066](https://github.com/pocketbase/pocketbase/issues/6066)).
|
||||||
|
|
||||||
|
- Other minor fixes (updated Go deps, skipped unnecessary validator check when the default primary key pattern is used, updated JSVM types, etc.).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.5
|
||||||
|
|
||||||
|
- Fixed UI logs search not properly accounting for the "Include requests by superusers" toggle when multiple search expressions are used.
|
||||||
|
|
||||||
|
- Fixed `text` field max validation error message ([#6053](https://github.com/pocketbase/pocketbase/issues/6053)).
|
||||||
|
|
||||||
|
- Other minor fixes (comment typos, JSVM types update).
|
||||||
|
|
||||||
|
- Updated Go deps and the min Go release GitHub action version to 1.23.4.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.4
|
||||||
|
|
||||||
|
- Fixed `autodate` fields not refreshing when calling `Save` multiple times on the same `Record` instance ([#6000](https://github.com/pocketbase/pocketbase/issues/6000)).
|
||||||
|
|
||||||
|
- Added more descriptive test OTP id and failure log message ([#5982](https://github.com/pocketbase/pocketbase/discussions/5982)).
|
||||||
|
|
||||||
|
- Moved the default UI CSP from meta tag to response header ([#5995](https://github.com/pocketbase/pocketbase/discussions/5995)).
|
||||||
|
|
||||||
|
- Updated Go and npm dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.3
|
||||||
|
|
||||||
|
- Fixed Gzip middleware not applying when serving static files.
|
||||||
|
|
||||||
|
- Fixed `Record.Fresh()`/`Record.Clone()` methods not properly cloning `autodate` fields ([#5973](https://github.com/pocketbase/pocketbase/discussions/5973)).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.2
|
||||||
|
|
||||||
|
- Fixed `RecordQuery()` custom struct scanning ([#5958](https://github.com/pocketbase/pocketbase/discussions/5958)).
|
||||||
|
|
||||||
|
- Fixed `--dev` log query print formatting.
|
||||||
|
|
||||||
|
- Added support for passing more than one id in the `Hook.Unbind` method for consistency with the router.
|
||||||
|
|
||||||
|
- Added collection rules change list in the confirmation popup
|
||||||
|
(_to avoid getting anoying during development, the rules confirmation currently is enabled only when using https_).
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.1
|
||||||
|
|
||||||
|
- Added `RequestEvent.Blob(status, contentType, bytes)` response write helper ([#5940](https://github.com/pocketbase/pocketbase/discussions/5940)).
|
||||||
|
|
||||||
|
- Added more descriptive error messages.
|
||||||
|
|
||||||
|
|
||||||
|
## v0.23.0
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You don't have to upgrade to PocketBase v0.23.0 if you are not planning further developing
|
||||||
|
> your existing app and/or are satisfied with the v0.22.x features set. There are no identified critical issues
|
||||||
|
> with PocketBase v0.22.x yet and in the case of critical bugs and security vulnerabilities, the fixes
|
||||||
|
> will be backported for at least until Q1 of 2025 (_if not longer_).
|
||||||
|
>
|
||||||
|
> **If you don't plan upgrading make sure to pin the SDKs version to their latest PocketBase v0.22.x compatible:**
|
||||||
|
> - JS SDK: `<0.22.0`
|
||||||
|
> - Dart SDK: `<0.19.0`
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> This release introduces many Go/JSVM and Web APIs breaking changes!
|
||||||
|
>
|
||||||
|
> Existing `pb_data` will be automatically upgraded with the start of the new executable,
|
||||||
|
> but custom Go or JSVM (`pb_hooks`, `pb_migrations`) and JS/Dart SDK code will have to be migrated manually.
|
||||||
|
> Please refer to the below upgrade guides:
|
||||||
|
> - Go: https://pocketbase.io/v023upgrade/go/.
|
||||||
|
> - JSVM: https://pocketbase.io/v023upgrade/jsvm/.
|
||||||
|
>
|
||||||
|
> If you had already switched to some of the earlier `<v0.23.0-rc14` versions and have generated a full collections snapshot migration (aka. `./pocketbase migrate collections`), then you may have to regenerate the migration file to ensure that it includes the latest changes.
|
||||||
|
|
||||||
|
PocketBase v0.23.0 is a major refactor of the internals with the overall goal of making PocketBase an easier to use Go framework.
|
||||||
|
There are a lot of changes but to highlight some of the most notable ones:
|
||||||
|
|
||||||
|
- New and more [detailed documentation](https://pocketbase.io/docs/).
|
||||||
|
_The old documentation could be accessed at [pocketbase.io/old](https://pocketbase.io/old/)._
|
||||||
|
- Replaced `echo` with a new router built on top of the Go 1.22 `net/http` mux enhancements.
|
||||||
|
- Merged `daos` packages in `core.App` to simplify the DB operations (_the `models` package structs are also migrated in `core`_).
|
||||||
|
- Option to specify custom `DBConnect` function as part of the app configuration to allow different `database/sql` SQLite drivers (_turso/libsql, sqlcipher, etc._) and custom builds.
|
||||||
|
_Note that we no longer loads the `mattn/go-sqlite3` driver by default when building with `CGO_ENABLED=1` to avoid `multiple definition` linker errors in case different CGO SQLite drivers or builds are used. You can find an example how to enable it back if you want to in the [new documentation](https://pocketbase.io/docs/go-overview/#github-commattngo-sqlite3)._
|
||||||
|
- New hooks allowing better control over the execution chain and error handling (_including wrapping an entire hook chain in a single DB transaction_).
|
||||||
|
- Various `Record` model improvements (_support for get/set modifiers, simplfied file upload by treating the file(s) as regular field value like `record.Set("document", file)`, etc._).
|
||||||
|
- Dedicated fields structs with safer defaults to make it easier creating/updating collections programmatically.
|
||||||
|
- Option to mark field as "Hidden", disallowing regular users to read or modify it (_there is also a dedicated Record hook to hide/unhide Record fields programmatically from a single place_).
|
||||||
|
- Option to customize the default system collection fields (`id`, `email`, `password`, etc.).
|
||||||
|
- Admins are now system `_superusers` auth records.
|
||||||
|
- Builtin rate limiter (_supports tags, wildcards and exact routes matching_).
|
||||||
|
- Batch/transactional Web API endpoint.
|
||||||
|
- Impersonate Web API endpoint (_it could be also used for generating fixed/nonrenewable superuser tokens, aka. "API keys"_).
|
||||||
|
- Support for custom user request activity log attributes.
|
||||||
|
- One-Time Password (OTP) auth method (_via email code_).
|
||||||
|
- Multi-Factor Authentication (MFA) support (_currently requires any 2 different auth methods to be used_).
|
||||||
|
- Support for Record "proxy/projection" in preparation for the planned autogeneration of typed Go record models.
|
||||||
|
- Linear OAuth2 provider ([#5909](https://github.com/pocketbase/pocketbase/pull/5909); thanks @chnfyi).
|
||||||
|
- WakaTime OAuth2 provider ([#5829](https://github.com/pocketbase/pocketbase/pull/5829); thanks @tigawanna).
|
||||||
|
- Notion OAuth2 provider ([#4999](https://github.com/pocketbase/pocketbase/pull/4999); thanks @s-li1).
|
||||||
|
- monday.com OAuth2 provider ([#5346](https://github.com/pocketbase/pocketbase/pull/5346); thanks @Jaytpa01).
|
||||||
|
- New Instagram provider compatible with the new Instagram Login APIs ([#5588](https://github.com/pocketbase/pocketbase/pull/5588); thanks @pnmcosta).
|
||||||
|
_The provider key is `instagram2` to prevent conflicts with existing linked users._
|
||||||
|
- Option to retrieve the OIDC OAuth2 user info from the `id_token` payload for the cases when the provider doesn't have a dedicated user info endpoint.
|
||||||
|
- Various minor UI improvements (_recursive `Presentable` view, slightly different collection options organization, zoom/pan for the logs chart, etc._)
|
||||||
|
- and many more...
|
||||||
|
|
||||||
|
#### Go/JSVM APIs changes
|
||||||
|
|
||||||
|
> - Go: https://pocketbase.io/v023upgrade/go/.
|
||||||
|
> - JSVM: https://pocketbase.io/v023upgrade/jsvm/.
|
||||||
|
|
||||||
|
#### SDKs changes
|
||||||
|
|
||||||
|
- [JS SDK v0.22.0](https://github.com/pocketbase/js-sdk/blob/master/CHANGELOG.md)
|
||||||
|
- [Dart SDK v0.19.0](https://github.com/pocketbase/dart-sdk/blob/master/CHANGELOG.md)
|
||||||
|
|
||||||
|
#### Web APIs changes
|
||||||
|
|
||||||
|
- New `POST /api/batch` endpoint.
|
||||||
|
|
||||||
|
- New `GET /api/collections/meta/scaffolds` endpoint.
|
||||||
|
|
||||||
|
- New `DELETE /api/collections/{collection}/truncate` endpoint.
|
||||||
|
|
||||||
|
- New `POST /api/collections/{collection}/request-otp` endpoint.
|
||||||
|
|
||||||
|
- New `POST /api/collections/{collection}/auth-with-otp` endpoint.
|
||||||
|
|
||||||
|
- New `POST /api/collections/{collection}/impersonate/{id}` endpoint.
|
||||||
|
|
||||||
|
- ⚠️ If you are constructing requests to `/api/*` routes manually remove the trailing slash (_there is no longer trailing slash removal middleware registered by default_).
|
||||||
|
|
||||||
|
- ⚠️ Removed `/api/admins/*` endpoints because admins are converted to `_superusers` auth collection records.
|
||||||
|
|
||||||
|
- ⚠️ Previously when uploading new files to a multiple `file` field, new files were automatically appended to the existing field values.
|
||||||
|
This behaviour has changed with v0.23+ and for consistency with the other multi-valued fields when uploading new files they will replace the old ones. If you want to prepend or append new files to an existing multiple `file` field value you can use the `+` prefix or suffix:
|
||||||
|
```js
|
||||||
|
"documents": [file1, file2] // => [file1_name, file2_name]
|
||||||
|
"+documents": [file1, file2] // => [file1_name, file2_name, old1_name, old2_name]
|
||||||
|
"documents+": [file1, file2] // => [old1_name, old2_name, file1_name, file2_name]
|
||||||
|
```
|
||||||
|
|
||||||
|
- ⚠️ Removed `GET /records/{id}/external-auths` and `DELETE /records/{id}/external-auths/{provider}` endpoints because this is now handled by sending list and delete requests to the `_externalAuths` collection.
|
||||||
|
|
||||||
|
- ⚠️ Changes to the app settings model fields and response (+new options such as `trustedProxy`, `rateLimits`, `batch`, etc.). The app settings Web APIs are mostly used by the Dashboard UI and rarely by the end users, but if you want to check all settings changes please refer to the [Settings Go struct](https://github.com/pocketbase/pocketbase/blob/develop/core/settings_model.go#L121).
|
||||||
|
|
||||||
|
- ⚠️ New flatten Collection model and fields structure. The Collection model Web APIs are mostly used by the Dashboard UI and rarely by the end users, but if you want to check all changes please refer to the [Collection Go struct](https://github.com/pocketbase/pocketbase/blob/develop/core/collection_model.go#L308).
|
||||||
|
|
||||||
|
- ⚠️ The top level error response `code` key was renamed to `status` for consistency with the Go APIs.
|
||||||
|
The error field key remains `code`:
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"status": 400, // <-- old: "code"
|
||||||
|
"message": "Failed to create record.",
|
||||||
|
"data": {
|
||||||
|
"title": {
|
||||||
|
"code": "validation_required",
|
||||||
|
"message": "Missing required value."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- ⚠️ New fields in the `GET /api/collections/{collection}/auth-methods` response.
|
||||||
|
_The old `authProviders`, `usernamePassword`, `emailPassword` fields are still returned in the response but are considered deprecated and will be removed in the future._
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"mfa": {
|
||||||
|
"duration": 100,
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"otp": {
|
||||||
|
"duration": 0,
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"enabled": true,
|
||||||
|
"identityFields": ["email", "username"]
|
||||||
|
},
|
||||||
|
"oauth2": {
|
||||||
|
"enabled": true,
|
||||||
|
"providers": [{"name": "gitlab", ...}, {"name": "google", ...}]
|
||||||
|
},
|
||||||
|
// old fields...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- ⚠️ Soft-deprecated the OAuth2 auth success `meta.avatarUrl` field in favour of `meta.avatarURL`.
|
||||||
194
docs/DEV_NOTES.md
Normal file
194
docs/DEV_NOTES.md
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
# TipiLAN Bot - Developer Reference
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `bot.py` | All Discord commands, views (UI components), event handlers, reminder system |
|
||||||
|
| `economy.py` | All economy logic, data model, constants (SHOP, COOLDOWNS, LEVEL_ROLES, etc.) |
|
||||||
|
| `pb_client.py` | Async PocketBase REST client - auth token cache, CRUD on `economy_users` collection |
|
||||||
|
| `strings.py` | **Single source of truth for all user-facing text.** Edit here to change any message. |
|
||||||
|
| `sheets.py` | Google Sheets integration (member sync) |
|
||||||
|
| `member_sync.py` | Birthday/member sync background task |
|
||||||
|
| `config.py` | Environment variables (TOKEN, GUILD_ID, PB_URL, etc.) |
|
||||||
|
| `scripts/migrate_to_pb.py` | One-time utility: migrate `data/economy.json` → PocketBase |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Economy Command
|
||||||
|
|
||||||
|
Checklist - do all of these, in order:
|
||||||
|
|
||||||
|
1. **`economy.py`** - add the `do_<cmd>` async function with cooldown check, logic, `_commit`, and `_txn` logging
|
||||||
|
2. **`economy.py`** - add the cooldown to `COOLDOWNS` dict if it has one
|
||||||
|
3. **`economy.py`** - add the EXP reward to `EXP_REWARDS` dict
|
||||||
|
4. **`strings.py` `CMD`** - add the slash command description
|
||||||
|
5. **`strings.py` `OPT`** - add any parameter descriptions
|
||||||
|
6. **`strings.py` `TITLE`** - add embed title(s) for success/fail states
|
||||||
|
7. **`strings.py` `ERR`** - add any error messages (banned, cooldown uses `CD_MSG`, jailed uses `CD_MSG["jailed"]`)
|
||||||
|
8. **`strings.py` `CD_MSG`** - add cooldown message if command has a cooldown
|
||||||
|
9. **`strings.py` `HELP_CATEGORIES["tipibot"]["fields"]`** - add the command to the help embed
|
||||||
|
10. **`bot.py`** - implement the `cmd_<name>` function, handle all `res["reason"]` cases
|
||||||
|
11. **`bot.py`** - call `_maybe_remind` if the command has a cooldown and reminders make sense
|
||||||
|
12. **`bot.py`** - call `_award_exp(interaction, economy.EXP_REWARDS["<cmd>"])` on success
|
||||||
|
13. **`strings.py` `REMINDER_OPTS`** - add a reminder option if the command needs one
|
||||||
|
14. **`bot.py` `_maybe_remind`** - if the command has an item-modified cooldown, add an `elif` branch
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Shop Item
|
||||||
|
|
||||||
|
Checklist:
|
||||||
|
|
||||||
|
1. **`economy.py` `SHOP`** - add the item dict `{name, emoji, cost, description: strings.ITEM_DESCRIPTIONS["key"]}`
|
||||||
|
2. **`economy.py` `SHOP_TIERS`** - add the key to the correct tier list (1/2/3)
|
||||||
|
3. **`economy.py` `SHOP_LEVEL_REQ`** - add minimum level if it is T2 (≥10) or T3 (≥20)
|
||||||
|
4. **`strings.py` `ITEM_DESCRIPTIONS`** - add the item description (Estonian flavour + English effect)
|
||||||
|
5. **`strings.py` `HELP_CATEGORIES["shop"]["fields"]`** - add display entry (sorted by cost)
|
||||||
|
6. If the item modifies a cooldown:
|
||||||
|
- **`economy.py`** - add the `if "item" in user["items"]` branch in the relevant `do_<cmd>` function
|
||||||
|
- **`bot.py` `_maybe_remind`** - add `elif cmd == "<cmd>" and "<item>" in items:` branch with the new delay
|
||||||
|
- **`bot.py` `cmd_cooldowns`** - add the item annotation to the relevant status line
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Level Role
|
||||||
|
|
||||||
|
1. **`economy.py` `LEVEL_ROLES`** - add `(min_level, "RoleName")` in descending level order (highest first)
|
||||||
|
2. **`bot.py` `_ensure_level_role`** - no changes needed (uses `LEVEL_ROLES` dynamically)
|
||||||
|
3. Run **`/economysetup`** in the server to create the role and set its position
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Adding a New Admin Command
|
||||||
|
|
||||||
|
1. **`strings.py` `CMD`** - add `"[Admin] ..."` description
|
||||||
|
2. **`strings.py` `HELP_CATEGORIES["admin"]["fields"]`** - add the entry
|
||||||
|
3. **`bot.py`** - add `@app_commands.default_permissions(manage_guild=True)` and `@app_commands.guild_only()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Economy System Design
|
||||||
|
|
||||||
|
### Storage
|
||||||
|
|
||||||
|
All economy state is stored in **PocketBase** (`economy_users` collection). `pb_client.py` owns all reads/writes. Each `do_*` function in `economy.py` calls `get_user()` → mutates the local dict → calls `_commit()`. `_commit` does a `PATCH` to PocketBase.
|
||||||
|
|
||||||
|
### Currency & Income Sources
|
||||||
|
|
||||||
|
| Command | Cooldown | Base Earn | Notes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `/daily` | 20h (18h w/ korvaklapid) | 150⬡ | ×streak multiplier, ×2 w/ lan_pass, +5% interest w/ gaming_laptop |
|
||||||
|
| `/work` | 1h (40min w/ monitor) | 15-75⬡ | ×1.5 w/ gaming_hiir, ×1.25 w/ reguleeritav_laud, ×3 30% chance w/ energiajook |
|
||||||
|
| `/beg` | 5min (3min w/ hiirematt) | 10-40⬡ | ×2 w/ klaviatuur |
|
||||||
|
| `/crime` | 2h | 200-500⬡ win | 60% success (75% w/ cat6), +30% w/ mikrofon; fail = fine + jail |
|
||||||
|
| `/rob` | 2h | 10–25% of target | 45% success (60% w/ jellyfin); fail = fine; house rob: 35% success, 5–40% jackpot |
|
||||||
|
| `/slots` | - | varies | jackpot=10× (15× w/ monitor_360), triple=4× (6×), pair=1× |
|
||||||
|
| `/roulette` | - | 2× red/black, 14× green | 1/37 green chance |
|
||||||
|
| `/blackjack` | - | 1:1 win, 3:2 BJ, 2:1 double | Dealer stands on 17+; double down on first action only |
|
||||||
|
|
||||||
|
### "all" Keyword
|
||||||
|
Commands that accept a coin amount (`/give`, `/roulette`, `/rps`, `/slots`, `/blackjack`) accept `"all"` to mean the user's full current balance. Parsed by `_parse_amount(value, balance)` in `bot.py`.
|
||||||
|
|
||||||
|
### Daily Streak Multipliers
|
||||||
|
- 1-2 days: ×1.0 (150⬡)
|
||||||
|
- 3-6 days: ×1.5 (225⬡)
|
||||||
|
- 7-13 days: ×2.0 (300⬡)
|
||||||
|
- 14+ days: ×3.0 (450⬡)
|
||||||
|
- `karikas` item: streak survives missed days
|
||||||
|
|
||||||
|
### Jail
|
||||||
|
- Duration: 30 minutes (`JAIL_DURATION`)
|
||||||
|
- `gaming_tool`: prevents jail on crime fail
|
||||||
|
- `/jailbreak`: 3 dice rolls, need doubles to escape free. On fail - bail = 20-30% of balance, min 350⬡. If balance < 350⬡, player stays jailed until timer.
|
||||||
|
- **Blocked while jailed**: `/work`, `/beg`, `/crime`, `/rob`, `/give` (checked in `do_*` functions via `_is_jailed`)
|
||||||
|
|
||||||
|
### EXP Rewards (from `EXP_REWARDS` in economy.py)
|
||||||
|
EXP is awarded on every successful command use. Level formula: `floor(sqrt(exp / 10))`, so Level 5 = 250 EXP, Level 10 = 1000, Level 20 = 4000, Level 30 = 9000.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role Hierarchy (Discord)
|
||||||
|
|
||||||
|
Order top to bottom in server roles:
|
||||||
|
|
||||||
|
```
|
||||||
|
[Bot managed role] ← bot's own role, always at top of our stack
|
||||||
|
ECONOMY ← given to everyone who uses any economy command
|
||||||
|
TipiLEGEND ← level 30+
|
||||||
|
TipiCHAD ← level 20+
|
||||||
|
TipiHUSTLER ← level 10+
|
||||||
|
TipiGRINDER ← level 5+
|
||||||
|
TipiNOOB ← level 1+
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `/economysetup` to auto-create all roles and set their positions. The command is idempotent - safe to run multiple times.
|
||||||
|
|
||||||
|
Role assignment:
|
||||||
|
- **ECONOMY** role: given automatically on first EXP award (i.e. first successful economy command)
|
||||||
|
- **Level roles**: given/swapped automatically on level-up; synced on `/rank`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Shop Tiers & Level Requirements
|
||||||
|
|
||||||
|
| Tier | Level Required | Items |
|
||||||
|
|---|---|---|
|
||||||
|
| T1 | 0 (any) | gaming_hiir, hiirematt, korvaklapid, lan_pass, anticheat, energiajook, gaming_laptop |
|
||||||
|
| T2 | 10 | reguleeritav_laud, jellyfin, mikrofon, klaviatuur, monitor, cat6 |
|
||||||
|
| T3 | 20 | monitor_360, karikas, gaming_tool |
|
||||||
|
|
||||||
|
Shop display is sorted by cost (ascending) within each tier.
|
||||||
|
The `SHOP_LEVEL_REQ` dict in `economy.py` controls per-item lock thresholds.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## strings.py Organisation
|
||||||
|
|
||||||
|
| Section | Dict | Usage in bot.py |
|
||||||
|
|---|---|---|
|
||||||
|
| Flavour text | `WORK_JOBS`, `BEG_LINES`, `CRIME_WIN`, `CRIME_LOSE` | Randomised descriptions |
|
||||||
|
| Command descriptions | `CMD["key"]` | `@tree.command(description=S.CMD["key"])` |
|
||||||
|
| Parameter descriptions | `OPT["key"]` | `@app_commands.describe(param=S.OPT["key"])` |
|
||||||
|
| Help embed | `HELP_CATEGORIES["cat"]` | `cmd_help` |
|
||||||
|
| Banned message | `MSG_BANNED` | All banned checks |
|
||||||
|
| Maintenance mode | `MSG_MAINTENANCE` | Shown when `_PAUSED=True` in bot.py (toggled by `/pause`) |
|
||||||
|
| Reminder options | `REMINDER_OPTS` | `RemindersSelect` dropdown |
|
||||||
|
| Slots outcomes | `SLOTS_TIERS["tier"]` → `(title, color)` | `cmd_slots` |
|
||||||
|
| Embed titles | `TITLE["key"]` | `discord.Embed(title=S.TITLE["key"])` |
|
||||||
|
| Error messages | `ERR["key"]` | `send_message(S.ERR["key"])` - use `.format(**kwargs)` for dynamic parts |
|
||||||
|
| Cooldown messages | `CD_MSG["cmd"].format(ts=_cd_ts(...))` | Cooldown responses |
|
||||||
|
| Shop UI | `SHOP_UI["key"]` | `_shop_embed` |
|
||||||
|
| Item descriptions | `ITEM_DESCRIPTIONS["item_key"]` | `economy.SHOP[key]["description"]` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Constants Location Quick-Reference
|
||||||
|
|
||||||
|
| Constant | File | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| `SHOP` | `economy.py` | All shop items (name, emoji, cost, description) |
|
||||||
|
| `SHOP_TIERS` | `economy.py` | Which items are in T1/T2/T3 |
|
||||||
|
| `SHOP_LEVEL_REQ` | `economy.py` | Min level per item |
|
||||||
|
| `COOLDOWNS` | `economy.py` | Base cooldown per command |
|
||||||
|
| `JAIL_DURATION` | `economy.py` | How long jail lasts |
|
||||||
|
| `LEVEL_ROLES` | `economy.py` | `[(min_level, "RoleName"), ...]` highest first |
|
||||||
|
| `ECONOMY_ROLE` | `economy.py` | Name of the base economy participation role |
|
||||||
|
| `EXP_REWARDS` | `economy.py` | EXP per command |
|
||||||
|
| `HOUSE_ID` | `economy.py` | Bot's user ID (house account for /rob) |
|
||||||
|
| `MIN_BAIL` | `economy.py` | Minimum bail payment (350⬡) |
|
||||||
|
| `COIN` | `economy.py` | The coin emoji string |
|
||||||
|
| `_PAUSED` | `bot.py` | In-memory maintenance flag; toggled by `/pause`; blocks all non-admin commands |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Balance Notes (as of current version)
|
||||||
|
|
||||||
|
- **Beg** is most efficient for active players (3min cooldown + 2× multiplier w/ `klaviatuur` = high ⬡/hr)
|
||||||
|
- **Work** is best for passive players (1h cooldown, fire and forget)
|
||||||
|
- **Crime** is high risk/reward - best with `cat6` + `mikrofon`
|
||||||
|
- **`lan_pass`** (1200⬡) doubles daily - good long-term investment
|
||||||
|
- **`gaming_laptop`** (1500⬡) 5% interest, capped 500⬡/day - snowballs with large balance
|
||||||
|
- `anticheat` is consumable (2 uses) - only item that can be re-bought
|
||||||
|
- `karikas` (T3) is the only item that preserves a daily streak across missed days
|
||||||
|
- `reguleeritav_laud` (T2) stacks with `gaming_hiir`: combined ×1.5 × ×1.25 = ×1.875
|
||||||
72
docs/POCKETBASE_SETUP.md
Normal file
72
docs/POCKETBASE_SETUP.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# PocketBase Setup
|
||||||
|
|
||||||
|
## 1. Download & run PocketBase
|
||||||
|
|
||||||
|
Download the binary for your OS from https://pocketbase.io/docs/ and run it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./pocketbase serve
|
||||||
|
# Admin UI: http://127.0.0.1:8090/_/
|
||||||
|
```
|
||||||
|
|
||||||
|
Create your admin account on first launch via the Admin UI.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Create the `economy_users` collection
|
||||||
|
|
||||||
|
In the Admin UI → **Collections** → **New collection** → name it exactly `economy_users`.
|
||||||
|
|
||||||
|
Add the following fields:
|
||||||
|
|
||||||
|
| Field name | Type | Required | Default |
|
||||||
|
|-------------------|-----------|----------|---------|
|
||||||
|
| `user_id` | Text | ✅ | - |
|
||||||
|
| `balance` | Number | | `0` |
|
||||||
|
| `exp` | Number | | `0` |
|
||||||
|
| `daily_streak` | Number | | `0` |
|
||||||
|
| `last_daily` | Text | | - |
|
||||||
|
| `last_work` | Text | | - |
|
||||||
|
| `last_beg` | Text | | - |
|
||||||
|
| `last_crime` | Text | | - |
|
||||||
|
| `last_rob` | Text | | - |
|
||||||
|
| `last_streak_date`| Text | | - |
|
||||||
|
| `jailed_until` | Text | | - |
|
||||||
|
| `items` | JSON | | `[]` |
|
||||||
|
| `item_uses` | JSON | | `{}` |
|
||||||
|
| `reminders` | JSON | | `[]` |
|
||||||
|
| `eco_banned` | Bool | | `false` |
|
||||||
|
|
||||||
|
> **Tip:** Set `user_id` as a unique index under **Indexes** tab.
|
||||||
|
|
||||||
|
Set **API rules** (all four: list, view, create, update) to admin-only (leave blank / locked).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Configure .env
|
||||||
|
|
||||||
|
Add to your `.env`:
|
||||||
|
|
||||||
|
```
|
||||||
|
PB_URL=http://127.0.0.1:8090
|
||||||
|
PB_ADMIN_EMAIL=your-admin@email.com
|
||||||
|
PB_ADMIN_PASSWORD=your-admin-password
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Migrate existing data (one-time)
|
||||||
|
|
||||||
|
If you have existing data in `data/economy.json`, run the migration script **once** before starting the bot:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python migrate_to_pb.py
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Production
|
||||||
|
|
||||||
|
On a server, run PocketBase as a background service (systemd, Docker, etc.) and update `PB_URL` in `.env` to the server's address.
|
||||||
|
|
||||||
|
PocketBase stores all data in `pb_data/` - back this directory up regularly.
|
||||||
1288
economy.py
Normal file
1288
economy.py
Normal file
File diff suppressed because it is too large
Load Diff
1519
logs/bot.log
Normal file
1519
logs/bot.log
Normal file
File diff suppressed because it is too large
Load Diff
714
logs/transactions.log
Normal file
714
logs/transactions.log
Normal file
@@ -0,0 +1,714 @@
|
|||||||
|
2026-03-20 01:34:58 | WORK user=340451525799182357 earned=+123 lucky=False bal=27988
|
||||||
|
2026-03-20 01:35:02 | BEG user=340451525799182357 earned=+24 jailed=False bal=28012
|
||||||
|
2026-03-20 01:35:39 | ROB_FAIL robber=340451525799182357 victim=218972931701735424 fine=-120 robber_bal=27892
|
||||||
|
2026-03-20 01:35:56 | SLOTS_MISS user=340451525799182357 bet=100 change=-100 bal=27792
|
||||||
|
2026-03-20 01:36:04 | SLOTS_PAIR user=340451525799182357 bet=100 change=50 bal=27842
|
||||||
|
2026-03-20 01:36:11 | SLOTS_MISS user=340451525799182357 bet=100 change=-100 bal=27742
|
||||||
|
2026-03-20 01:36:19 | SLOTS_PAIR user=340451525799182357 bet=100 change=50 bal=27792
|
||||||
|
2026-03-20 01:37:38 | BLACKJACK user=340451525799182357 payout=+400 net=+200 bal=27992
|
||||||
|
2026-03-20 01:38:07 | BEG user=340451525799182357 earned=+30 jailed=False bal=28022
|
||||||
|
2026-03-20 01:38:23 | BLACKJACK user=340451525799182357 payout=+0 net=-100 bal=27922
|
||||||
|
2026-03-20 01:38:43 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=26922
|
||||||
|
2026-03-20 01:39:15 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=27922
|
||||||
|
2026-03-20 01:39:36 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=29922
|
||||||
|
2026-03-20 01:39:49 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=30922
|
||||||
|
2026-03-20 01:40:02 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=31922
|
||||||
|
2026-03-20 01:40:12 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=30922
|
||||||
|
2026-03-20 01:40:26 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=29922
|
||||||
|
2026-03-20 01:40:40 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=30922
|
||||||
|
2026-03-20 01:40:54 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=31922
|
||||||
|
2026-03-20 01:41:05 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=30922
|
||||||
|
2026-03-20 01:41:26 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=29922
|
||||||
|
2026-03-20 01:41:35 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=31422
|
||||||
|
2026-03-20 01:42:32 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=32422
|
||||||
|
2026-03-20 01:42:46 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=31422
|
||||||
|
2026-03-20 01:43:34 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=30422
|
||||||
|
2026-03-20 01:43:48 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=32422
|
||||||
|
2026-03-20 01:44:00 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=31422
|
||||||
|
2026-03-20 01:44:11 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=32422
|
||||||
|
2026-03-20 01:44:22 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=33422
|
||||||
|
2026-03-20 01:44:47 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=35422
|
||||||
|
2026-03-20 01:45:02 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=36422
|
||||||
|
2026-03-20 01:45:17 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=35422
|
||||||
|
2026-03-20 01:45:28 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=36422
|
||||||
|
2026-03-20 01:45:42 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=37422
|
||||||
|
2026-03-20 01:45:55 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=38422
|
||||||
|
2026-03-20 01:46:15 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=39422
|
||||||
|
2026-03-20 01:46:27 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=38422
|
||||||
|
2026-03-20 01:46:38 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=37422
|
||||||
|
2026-03-20 01:46:54 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=38422
|
||||||
|
2026-03-20 01:47:05 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=37422
|
||||||
|
2026-03-20 01:47:15 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=36422
|
||||||
|
2026-03-20 01:47:46 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=38422
|
||||||
|
2026-03-20 01:47:59 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=40422
|
||||||
|
2026-03-20 01:48:11 | BLACKJACK user=340451525799182357 payout=+2000 net=+0 bal=40422
|
||||||
|
2026-03-20 01:48:23 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=41422
|
||||||
|
2026-03-20 01:48:39 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=40422
|
||||||
|
2026-03-20 01:48:54 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=41422
|
||||||
|
2026-03-20 01:49:12 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=42422
|
||||||
|
2026-03-20 01:49:25 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=43422
|
||||||
|
2026-03-20 01:49:36 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=43422
|
||||||
|
2026-03-20 01:49:51 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=44422
|
||||||
|
2026-03-20 01:50:06 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=45422
|
||||||
|
2026-03-20 01:50:16 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=45422
|
||||||
|
2026-03-20 01:50:28 | BLACKJACK user=340451525799182357 payout=+0 net=-2000 bal=43422
|
||||||
|
2026-03-20 01:50:38 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=42422
|
||||||
|
2026-03-20 01:50:53 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=41422
|
||||||
|
2026-03-20 01:51:04 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=40422
|
||||||
|
2026-03-20 01:51:20 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=39422
|
||||||
|
2026-03-20 01:51:31 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=40422
|
||||||
|
2026-03-20 01:51:44 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=40422
|
||||||
|
2026-03-20 01:51:54 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=39422
|
||||||
|
2026-03-20 01:52:07 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=38422
|
||||||
|
2026-03-20 01:52:20 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=39422
|
||||||
|
2026-03-20 01:52:33 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=38422
|
||||||
|
2026-03-20 01:52:43 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=39422
|
||||||
|
2026-03-20 01:52:58 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=40422
|
||||||
|
2026-03-20 01:54:04 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=41422
|
||||||
|
2026-03-20 01:54:20 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=42422
|
||||||
|
2026-03-20 01:55:01 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=41422
|
||||||
|
2026-03-20 01:55:12 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=41422
|
||||||
|
2026-03-20 01:55:20 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=42922
|
||||||
|
2026-03-20 01:55:42 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=43922
|
||||||
|
2026-03-20 01:55:54 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=44922
|
||||||
|
2026-03-20 01:56:02 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=46422
|
||||||
|
2026-03-20 01:56:16 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=45422
|
||||||
|
2026-03-20 01:56:27 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=44422
|
||||||
|
2026-03-20 01:56:39 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=45422
|
||||||
|
2026-03-20 01:56:49 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=45422
|
||||||
|
2026-03-20 01:57:01 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=45422
|
||||||
|
2026-03-20 01:58:03 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=44422
|
||||||
|
2026-03-20 01:58:19 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43422
|
||||||
|
2026-03-20 01:59:08 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=42422
|
||||||
|
2026-03-20 01:59:22 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=43422
|
||||||
|
2026-03-20 01:59:37 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=44922
|
||||||
|
2026-03-20 01:59:56 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43922
|
||||||
|
2026-03-20 02:00:14 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=42922
|
||||||
|
2026-03-20 02:00:37 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=44422
|
||||||
|
2026-03-20 02:00:57 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=45422
|
||||||
|
2026-03-20 02:01:08 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=44422
|
||||||
|
2026-03-20 02:01:38 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43422
|
||||||
|
2026-03-20 02:01:56 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=42422
|
||||||
|
2026-03-20 02:02:15 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=43422
|
||||||
|
2026-03-20 02:02:30 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=44422
|
||||||
|
2026-03-20 02:02:43 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=45422
|
||||||
|
2026-03-20 02:02:55 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=44422
|
||||||
|
2026-03-20 02:03:07 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43422
|
||||||
|
2026-03-20 02:03:32 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=44422
|
||||||
|
2026-03-20 02:03:48 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=45422
|
||||||
|
2026-03-20 02:04:01 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=44422
|
||||||
|
2026-03-20 02:04:20 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43422
|
||||||
|
2026-03-20 02:04:32 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=44422
|
||||||
|
2026-03-20 02:04:45 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=43422
|
||||||
|
2026-03-20 02:04:57 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=45422
|
||||||
|
2026-03-20 02:05:17 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=46422
|
||||||
|
2026-03-20 02:09:33 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=47422
|
||||||
|
2026-03-20 02:09:46 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=48422
|
||||||
|
2026-03-20 02:10:00 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=49422
|
||||||
|
2026-03-20 02:10:17 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=48422
|
||||||
|
2026-03-20 02:10:27 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=47422
|
||||||
|
2026-03-20 02:10:41 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=48422
|
||||||
|
2026-03-20 02:11:43 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=49422
|
||||||
|
2026-03-20 02:20:03 | ROB_BLOCKED robber=178852380018868224 victim=340451525799182357 fine=-198 robber_bal=237 ac_uses_left=1
|
||||||
|
2026-03-20 02:50:48 | BEG user=178852380018868224 earned=+64 jailed=False bal=301
|
||||||
|
2026-03-20 02:50:50 | WORK user=178852380018868224 earned=+92 lucky=False bal=393
|
||||||
|
2026-03-20 02:50:53 | CRIME_WIN user=178852380018868224 earned=+414 bal=807
|
||||||
|
2026-03-20 03:11:24 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=48422
|
||||||
|
2026-03-20 04:25:19 | HEIST_HOUSE change=-79803 house_bal=123830
|
||||||
|
2026-03-20 04:25:19 | HEIST_WIN user=340451525799182357 change=+39901 bal=88323
|
||||||
|
2026-03-20 04:25:19 | HEIST_WIN user=178852380018868224 change=+39901 bal=40708
|
||||||
|
2026-03-20 04:26:00 | DAILY user=178852380018868224 earned=+950 streak=5 bal=41658
|
||||||
|
2026-03-20 04:28:21 | WORK user=340451525799182357 earned=+114 lucky=False bal=88437
|
||||||
|
2026-03-20 04:28:26 | BEG user=340451525799182357 earned=+72 jailed=False bal=88509
|
||||||
|
2026-03-20 04:29:11 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=89509
|
||||||
|
2026-03-20 04:30:44 | BLACKJACK user=340451525799182357 payout=+2500 net=+1500 bal=91009
|
||||||
|
2026-03-20 04:31:09 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=90009
|
||||||
|
2026-03-20 04:31:28 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=91009
|
||||||
|
2026-03-20 04:31:45 | BLACKJACK user=340451525799182357 payout=+2000 net=+1000 bal=92009
|
||||||
|
2026-03-20 04:32:10 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=92009
|
||||||
|
2026-03-20 04:32:30 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=91009
|
||||||
|
2026-03-20 04:32:52 | BLACKJACK user=340451525799182357 payout=+4000 net=+2000 bal=93009
|
||||||
|
2026-03-20 04:33:11 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=92009
|
||||||
|
2026-03-20 04:33:32 | BLACKJACK user=340451525799182357 payout=+1000 net=+0 bal=92009
|
||||||
|
2026-03-20 04:33:48 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=91009
|
||||||
|
2026-03-20 04:34:07 | BLACKJACK user=340451525799182357 payout=+0 net=-1000 bal=90009
|
||||||
|
2026-03-20 04:34:26 | BLACKJACK user=340451525799182357 payout=+0 net=-3000 bal=87009
|
||||||
|
2026-03-20 04:34:51 | BLACKJACK user=340451525799182357 payout=+0 net=-10000 bal=77009
|
||||||
|
2026-03-20 04:35:14 | BLACKJACK user=340451525799182357 payout=+0 net=-20000 bal=57009
|
||||||
|
2026-03-20 04:35:33 | BLACKJACK user=340451525799182357 payout=+0 net=-57009 bal=0
|
||||||
|
2026-03-20 06:12:01 | DAILY user=272518654715887618 earned=+225 streak=5 bal=930
|
||||||
|
2026-03-20 06:43:11 | BEG user=338622999127261185 earned=+78 jailed=False bal=751
|
||||||
|
2026-03-20 06:43:13 | WORK user=338622999127261185 earned=+102 lucky=False bal=853
|
||||||
|
2026-03-20 06:43:17 | CRIME_WIN user=338622999127261185 earned=+331 bal=1184
|
||||||
|
2026-03-20 06:44:17 | ROB_FAIL robber=338622999127261185 victim=218972931701735424 fine=-111 robber_bal=1073
|
||||||
|
2026-03-20 06:46:27 | BEG user=338622999127261185 earned=+30 jailed=False bal=1103
|
||||||
|
2026-03-20 07:00:53 | DAILY user=824516445382901800 earned=+491 streak=5 bal=1328
|
||||||
|
2026-03-20 07:03:25 | BEG user=338622999127261185 earned=+24 jailed=False bal=1127
|
||||||
|
2026-03-20 07:03:29 | DAILY user=338622999127261185 earned=+450 streak=5 bal=1577
|
||||||
|
2026-03-20 07:03:37 | ROULETTE_LOSE user=338622999127261185 bet=1577 colour=punane result=roheline mult=1 bal=0
|
||||||
|
2026-03-20 07:06:42 | BEG user=338622999127261185 earned=+58 jailed=False bal=58
|
||||||
|
2026-03-20 07:17:30 | CRIME_WIN user=401373976431165449 earned=+461 bal=10256
|
||||||
|
2026-03-20 07:17:46 | ROB_WIN robber=401373976431165449 victim=218972931701735424 stolen=+703 jackpot=False robber_bal=10959 victim_bal=2816
|
||||||
|
2026-03-20 07:17:52 | WORK user=401373976431165449 earned=+174 lucky=True bal=11133
|
||||||
|
2026-03-20 07:17:54 | BEG user=401373976431165449 earned=+58 jailed=False bal=11191
|
||||||
|
2026-03-20 07:18:00 | DAILY user=401373976431165449 earned=+950 streak=5 bal=12141
|
||||||
|
2026-03-20 07:25:09 | WORK user=338622999127261185 earned=+36 lucky=False bal=94
|
||||||
|
2026-03-20 07:25:11 | BEG user=338622999127261185 earned=+38 jailed=False bal=132
|
||||||
|
2026-03-20 07:28:30 | BEG user=401373976431165449 earned=+32 jailed=False bal=12173
|
||||||
|
2026-03-20 07:41:15 | BEG user=401373976431165449 earned=+38 jailed=False bal=12211
|
||||||
|
2026-03-20 07:51:21 | DAILY user=344531774518591498 earned=+500 streak=5 bal=1518
|
||||||
|
2026-03-20 07:51:27 | WORK user=344531774518591498 earned=+275 lucky=True bal=1793
|
||||||
|
2026-03-20 07:51:29 | BEG user=344531774518591498 earned=+42 jailed=False bal=1835
|
||||||
|
2026-03-20 07:51:39 | ROB_BLOCKED robber=344531774518591498 victim=178852380018868224 fine=-130 robber_bal=1705 ac_uses_left=0
|
||||||
|
2026-03-20 07:51:47 | CRIME_WIN user=344531774518591498 earned=+456 bal=2161
|
||||||
|
2026-03-20 07:55:18 | BLACKJACK user=344531774518591498 payout=+2000 net=+1000 bal=3161
|
||||||
|
2026-03-20 07:55:34 | BLACKJACK user=344531774518591498 payout=+0 net=-1000 bal=2161
|
||||||
|
2026-03-20 07:55:48 | BLACKJACK user=344531774518591498 payout=+0 net=-1000 bal=1161
|
||||||
|
2026-03-20 07:56:02 | BLACKJACK user=344531774518591498 payout=+1161 net=+0 bal=1161
|
||||||
|
2026-03-20 07:56:15 | BLACKJACK user=344531774518591498 payout=+0 net=-1161 bal=0
|
||||||
|
2026-03-20 08:08:09 | BEG user=401373976431165449 earned=+26 jailed=False bal=12237
|
||||||
|
2026-03-20 08:08:19 | WORK user=401373976431165449 earned=+205 lucky=False bal=12442
|
||||||
|
2026-03-20 08:25:18 | BEG user=401373976431165449 earned=+44 jailed=False bal=12486
|
||||||
|
2026-03-20 08:30:56 | HEIST_FAIL user=401373976431165449 fine=-1000 jailed_until=2026-03-20T08:00:56.238832+00:00 bal=11486
|
||||||
|
2026-03-20 08:30:56 | HEIST_FAIL user=824516445382901800 fine=-199 jailed_until=2026-03-20T08:00:56.238832+00:00 bal=1129
|
||||||
|
2026-03-20 08:31:23 | JAIL_FREE user=824516445382901800 method=doubles
|
||||||
|
2026-03-20 08:31:46 | JAIL_FREE user=401373976431165449 method=doubles
|
||||||
|
2026-03-20 08:32:25 | BEG user=401373976431165449 earned=+64 jailed=False bal=11550
|
||||||
|
2026-03-20 08:32:31 | BEG user=338622999127261185 earned=+52 jailed=False bal=184
|
||||||
|
2026-03-20 08:34:19 | WORK user=344531774518591498 earned=+258 lucky=True bal=258
|
||||||
|
2026-03-20 08:35:58 | BEG user=401373976431165449 earned=+72 jailed=False bal=11622
|
||||||
|
2026-03-20 08:46:55 | BEG user=401373976431165449 earned=+42 jailed=False bal=11664
|
||||||
|
2026-03-20 09:04:17 | WORK user=272518654715887618 earned=+83 lucky=False bal=1013
|
||||||
|
2026-03-20 09:06:05 | BEG user=401373976431165449 earned=+72 jailed=False bal=11736
|
||||||
|
2026-03-20 09:06:07 | WORK user=401373976431165449 earned=+54 lucky=False bal=11790
|
||||||
|
2026-03-20 09:17:49 | BEG user=401373976431165449 earned=+64 jailed=False bal=11854
|
||||||
|
2026-03-20 09:17:50 | CRIME_WIN user=401373976431165449 earned=+456 bal=12310
|
||||||
|
2026-03-20 09:18:22 | ROB_WIN robber=401373976431165449 victim=272518654715887618 stolen=+214 jackpot=False robber_bal=12524 victim_bal=799
|
||||||
|
2026-03-20 09:18:25 | WORK user=344531774518591498 earned=+61 lucky=False bal=319
|
||||||
|
2026-03-20 09:18:27 | BEG user=344531774518591498 earned=+28 jailed=False bal=347
|
||||||
|
2026-03-20 09:21:07 | BUY user=178852380018868224 item=anticheat cost=-1000 bal=40658
|
||||||
|
2026-03-20 09:28:45 | BEG user=401373976431165449 earned=+56 jailed=False bal=12580
|
||||||
|
2026-03-20 09:31:49 | BEG user=824516445382901800 earned=+80 jailed=False bal=1209
|
||||||
|
2026-03-20 09:32:13 | WORK user=824516445382901800 earned=+116 lucky=False bal=1325
|
||||||
|
2026-03-20 09:32:17 | CRIME_WIN user=824516445382901800 earned=+412 bal=1737
|
||||||
|
2026-03-20 09:32:24 | ROB_BLOCKED robber=824516445382901800 victim=323906492073771019 fine=-200 robber_bal=1537 ac_uses_left=1
|
||||||
|
2026-03-20 09:49:18 | BEG user=401373976431165449 earned=+68 jailed=False bal=12648
|
||||||
|
2026-03-20 09:49:23 | WORK user=401373976431165449 earned=+123 lucky=True bal=12771
|
||||||
|
2026-03-20 10:00:53 | BEG user=344531774518591498 earned=+54 jailed=False bal=401
|
||||||
|
2026-03-20 10:01:11 | CRIME_WIN user=344531774518591498 earned=+492 bal=893
|
||||||
|
2026-03-20 10:01:31 | ROB_BLOCKED robber=344531774518591498 victim=323906492073771019 fine=-110 robber_bal=783 ac_uses_left=0
|
||||||
|
2026-03-20 10:01:44 | WORK user=344531774518591498 earned=+168 lucky=False bal=951
|
||||||
|
2026-03-20 10:05:58 | BEG user=344531774518591498 earned=+54 jailed=False bal=1005
|
||||||
|
2026-03-20 10:10:28 | BEG user=344531774518591498 earned=+42 jailed=False bal=1047
|
||||||
|
2026-03-20 10:12:31 | BUY user=323906492073771019 item=anticheat cost=-1000 bal=42624
|
||||||
|
2026-03-20 10:14:15 | BEG user=323906492073771019 earned=+36 jailed=False bal=42660
|
||||||
|
2026-03-20 10:14:23 | WORK user=323906492073771019 earned=+101 lucky=False bal=42761
|
||||||
|
2026-03-20 10:17:56 | BEG user=338622999127261185 earned=+78 jailed=False bal=262
|
||||||
|
2026-03-20 10:17:58 | WORK user=338622999127261185 earned=+83 lucky=False bal=345
|
||||||
|
2026-03-20 10:18:01 | CRIME_WIN user=338622999127261185 earned=+290 bal=635
|
||||||
|
2026-03-20 10:18:44 | ROB_FAIL robber=338622999127261185 victim=209554152584380420 fine=-136 robber_bal=499
|
||||||
|
2026-03-20 10:24:36 | BEG user=344531774518591498 earned=+58 jailed=False bal=1105
|
||||||
|
2026-03-20 10:27:33 | BEG user=401373976431165449 earned=+32 jailed=False bal=12803
|
||||||
|
2026-03-20 10:28:15 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=12703
|
||||||
|
2026-03-20 10:28:27 | BEG user=344531774518591498 earned=+78 jailed=False bal=1183
|
||||||
|
2026-03-20 10:28:38 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=12803
|
||||||
|
2026-03-20 10:28:56 | GIVE from_=401373976431165449 to=344531774518591498 amount=500 from_bal=12203 to_bal=1683
|
||||||
|
2026-03-20 10:29:04 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=12403
|
||||||
|
2026-03-20 10:29:15 | BLACKJACK user=401373976431165449 payout=+250 net=+150 bal=12553
|
||||||
|
2026-03-20 10:29:36 | BLACKJACK user=401373976431165449 payout=+400 net=+200 bal=12753
|
||||||
|
2026-03-20 10:29:58 | BLACKJACK user=401373976431165449 payout=+100 net=+0 bal=12753
|
||||||
|
2026-03-20 10:30:11 | BLACKJACK user=401373976431165449 payout=+1250 net=+750 bal=13503
|
||||||
|
2026-03-20 10:30:28 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13403
|
||||||
|
2026-03-20 10:30:37 | WORK user=401373976431165449 earned=+371 lucky=True bal=13674
|
||||||
|
2026-03-20 10:31:05 | BLACKJACK user=401373976431165449 payout=+0 net=-200 bal=13574
|
||||||
|
2026-03-20 10:31:20 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13474
|
||||||
|
2026-03-20 10:31:35 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=13574
|
||||||
|
2026-03-20 10:31:47 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=13674
|
||||||
|
2026-03-20 10:32:03 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13574
|
||||||
|
2026-03-20 10:32:13 | BLACKJACK user=401373976431165449 payout=+250 net=+150 bal=13724
|
||||||
|
2026-03-20 10:38:41 | BEG user=401373976431165449 earned=+28 jailed=False bal=13752
|
||||||
|
2026-03-20 10:39:06 | BEG user=344531774518591498 earned=+28 jailed=False bal=1711
|
||||||
|
2026-03-20 10:39:57 | BLACKJACK user=401373976431165449 payout=+400 net=+200 bal=13952
|
||||||
|
2026-03-20 10:40:24 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=14052
|
||||||
|
2026-03-20 10:40:41 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13952
|
||||||
|
2026-03-20 10:40:52 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13852
|
||||||
|
2026-03-20 10:41:06 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=13952
|
||||||
|
2026-03-20 10:41:21 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13852
|
||||||
|
2026-03-20 10:41:36 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13752
|
||||||
|
2026-03-20 10:41:49 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=13852
|
||||||
|
2026-03-20 10:41:50 | BEG user=401373976431165449 earned=+62 jailed=False bal=13914
|
||||||
|
2026-03-20 10:41:58 | SLOTS_MISS user=401373976431165449 bet=100 change=-100 bal=13814
|
||||||
|
2026-03-20 10:42:22 | SLOTS_MISS user=401373976431165449 bet=100 change=-100 bal=13714
|
||||||
|
2026-03-20 10:43:45 | BLACKJACK user=401373976431165449 payout=+400 net=+200 bal=13914
|
||||||
|
2026-03-20 10:44:21 | BEG user=344531774518591498 earned=+36 jailed=False bal=1747
|
||||||
|
2026-03-20 10:44:22 | WORK user=344531774518591498 earned=+84 lucky=False bal=1831
|
||||||
|
2026-03-20 10:44:34 | BLACKJACK user=344531774518591498 payout=+3662 net=+1831 bal=3662
|
||||||
|
2026-03-20 10:44:46 | BLACKJACK user=344531774518591498 payout=+0 net=-3662 bal=0
|
||||||
|
2026-03-20 10:45:43 | BEG user=401373976431165449 earned=+56 jailed=False bal=13970
|
||||||
|
2026-03-20 10:47:55 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=14070
|
||||||
|
2026-03-20 10:48:06 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=13970
|
||||||
|
2026-03-20 10:48:14 | BLACKJACK user=401373976431165449 payout=+250 net=+150 bal=14120
|
||||||
|
2026-03-20 10:48:25 | BLACKJACK user=401373976431165449 payout=+0 net=-100 bal=14020
|
||||||
|
2026-03-20 10:48:49 | BEG user=401373976431165449 earned=+22 jailed=False bal=14042
|
||||||
|
2026-03-20 10:56:47 | BEG user=272518654715887618 earned=+13 jailed=False bal=812
|
||||||
|
2026-03-20 10:56:49 | WORK user=272518654715887618 earned=+105 lucky=False bal=917
|
||||||
|
2026-03-20 10:56:59 | CRIME_WIN user=272518654715887618 earned=+237 bal=1154
|
||||||
|
2026-03-20 10:57:12 | BEG user=344531774518591498 earned=+36 jailed=False bal=36
|
||||||
|
2026-03-20 10:58:57 | WORK user=338622999127261185 earned=+117 lucky=True bal=616
|
||||||
|
2026-03-20 10:59:29 | BEG user=401373976431165449 earned=+58 jailed=False bal=14100
|
||||||
|
2026-03-20 11:02:04 | BLACKJACK user=401373976431165449 payout=+0 net=-1000 bal=13100
|
||||||
|
2026-03-20 11:02:27 | BLACKJACK user=401373976431165449 payout=+200 net=+100 bal=13200
|
||||||
|
2026-03-20 11:02:43 | BEG user=344531774518591498 earned=+36 jailed=False bal=72
|
||||||
|
2026-03-20 11:05:34 | BEG user=401373976431165449 earned=+52 jailed=False bal=13252
|
||||||
|
2026-03-20 11:12:14 | WORK user=401373976431165449 earned=+230 lucky=True bal=13482
|
||||||
|
2026-03-20 11:12:25 | BEG user=401373976431165449 earned=+62 jailed=False bal=13544
|
||||||
|
2026-03-20 11:16:03 | BEG user=401373976431165449 earned=+48 jailed=False bal=13592
|
||||||
|
2026-03-20 11:16:45 | BEG user=824516445382901800 earned=+72 jailed=False bal=1609
|
||||||
|
2026-03-20 11:16:49 | WORK user=824516445382901800 earned=+71 lucky=False bal=1680
|
||||||
|
2026-03-20 11:17:03 | ROULETTE_LOSE user=824516445382901800 bet=1680 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 11:20:45 | GIVE from_=401373976431165449 to=824516445382901800 amount=1000 from_bal=12592 to_bal=1000
|
||||||
|
2026-03-20 11:20:50 | BEG user=344531774518591498 earned=+80 jailed=False bal=152
|
||||||
|
2026-03-20 11:21:33 | ROULETTE_LOSE user=824516445382901800 bet=1000 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 11:22:53 | BLACKJACK user=344531774518591498 payout=+304 net=+152 bal=304
|
||||||
|
2026-03-20 11:23:06 | BLACKJACK user=344531774518591498 payout=+0 net=-304 bal=0
|
||||||
|
2026-03-20 11:23:18 | BEG user=401373976431165449 earned=+38 jailed=False bal=12630
|
||||||
|
2026-03-20 11:23:28 | CRIME_WIN user=401373976431165449 earned=+347 bal=12977
|
||||||
|
2026-03-20 11:23:42 | ROB_FAIL robber=401373976431165449 victim=218972931701735424 fine=-205 robber_bal=12772
|
||||||
|
2026-03-20 11:24:13 | BEG user=344531774518591498 earned=+70 jailed=False bal=70
|
||||||
|
2026-03-20 11:24:43 | WORK user=344531774518591498 earned=+118 lucky=False bal=188
|
||||||
|
2026-03-20 11:24:57 | BLACKJACK user=344531774518591498 payout=+0 net=-188 bal=0
|
||||||
|
2026-03-20 11:38:51 | BEG user=272518654715887618 earned=+40 jailed=False bal=1194
|
||||||
|
2026-03-20 11:38:58 | BEG user=344531774518591498 earned=+80 jailed=False bal=80
|
||||||
|
2026-03-20 11:42:01 | WORK user=338622999127261185 earned=+27 lucky=False bal=643
|
||||||
|
2026-03-20 11:42:38 | BEG user=272518654715887618 earned=+21 jailed=False bal=1215
|
||||||
|
2026-03-20 11:42:41 | BEG user=344531774518591498 earned=+24 jailed=False bal=104
|
||||||
|
2026-03-20 11:47:54 | BEG user=338622999127261185 earned=+44 jailed=False bal=687
|
||||||
|
2026-03-20 11:50:32 | BEG user=272518654715887618 earned=+23 jailed=False bal=1238
|
||||||
|
2026-03-20 11:54:20 | WORK user=401373976431165449 earned=+56 lucky=False bal=12828
|
||||||
|
2026-03-20 11:54:26 | BEG user=401373976431165449 earned=+40 jailed=False bal=12868
|
||||||
|
2026-03-20 12:01:29 | BEG user=401373976431165449 earned=+56 jailed=False bal=12924
|
||||||
|
2026-03-20 12:04:36 | BEG user=401373976431165449 earned=+50 jailed=False bal=12974
|
||||||
|
2026-03-20 12:07:25 | ROB_BLOCKED robber=344531774518591498 victim=401373976431165449 fine=-169 robber_bal=0 ac_uses_left=1
|
||||||
|
2026-03-20 12:07:28 | BEG user=344531774518591498 earned=+34 jailed=False bal=34
|
||||||
|
2026-03-20 12:07:31 | CRIME_WIN user=344531774518591498 earned=+399 bal=433
|
||||||
|
2026-03-20 12:07:33 | WORK user=344531774518591498 earned=+90 lucky=True bal=523
|
||||||
|
2026-03-20 12:08:33 | BEG user=401373976431165449 earned=+34 jailed=False bal=13008
|
||||||
|
2026-03-20 12:11:44 | BEG user=401373976431165449 earned=+28 jailed=False bal=13036
|
||||||
|
2026-03-20 12:16:46 | BEG user=401373976431165449 earned=+66 jailed=False bal=13102
|
||||||
|
2026-03-20 12:17:10 | WORK user=824516445382901800 earned=+84 lucky=False bal=84
|
||||||
|
2026-03-20 12:17:11 | BEG user=824516445382901800 earned=+32 jailed=False bal=116
|
||||||
|
2026-03-20 12:17:13 | CRIME_WIN user=824516445382901800 earned=+501 bal=617
|
||||||
|
2026-03-20 12:17:22 | ROB_BLOCKED robber=824516445382901800 victim=344531774518591498 fine=-170 robber_bal=447 ac_uses_left=1
|
||||||
|
2026-03-20 12:17:37 | BEG user=344531774518591498 earned=+26 jailed=False bal=549
|
||||||
|
2026-03-20 12:19:11 | WORK user=178852380018868224 earned=+41 lucky=False bal=40699
|
||||||
|
2026-03-20 12:19:15 | BEG user=178852380018868224 earned=+32 jailed=False bal=40731
|
||||||
|
2026-03-20 12:19:18 | CRIME_WIN user=178852380018868224 earned=+460 bal=41191
|
||||||
|
2026-03-20 12:19:37 | ROULETTE_LOSE user=824516445382901800 bet=447 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 12:23:18 | SLOTS_PAIR user=178852380018868224 bet=10000 change=5000 bal=46191
|
||||||
|
2026-03-20 12:23:28 | SLOTS_MISS user=178852380018868224 bet=10000 change=-10000 bal=36191
|
||||||
|
2026-03-20 12:26:00 | BEG user=344531774518591498 earned=+40 jailed=False bal=589
|
||||||
|
2026-03-20 12:34:38 | BEG user=401373976431165449 earned=+74 jailed=False bal=13176
|
||||||
|
2026-03-20 12:34:41 | WORK user=401373976431165449 earned=+105 lucky=False bal=13281
|
||||||
|
2026-03-20 12:35:44 | HEIST_HOUSE change=-479646 house_bal=529905
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=824516445382901800 change=+59955 bal=59955
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=401373976431165449 change=+59955 bal=73236
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=178852380018868224 change=+59955 bal=96146
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=338622999127261185 change=+59955 bal=60642
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=340451525799182357 change=+59955 bal=59955
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=218972931701735424 change=+59955 bal=62771
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=344531774518591498 change=+59955 bal=60544
|
||||||
|
2026-03-20 12:35:44 | HEIST_WIN user=272518654715887618 change=+59955 bal=61193
|
||||||
|
2026-03-20 12:36:08 | ROULETTE_WIN user=178852380018868224 bet=96146 colour=punane result=punane mult=1 bal=192292
|
||||||
|
2026-03-20 12:36:25 | ROULETTE_WIN user=178852380018868224 bet=192292 colour=punane result=punane mult=1 bal=384584
|
||||||
|
2026-03-20 12:36:26 | ROULETTE_WIN user=824516445382901800 bet=59955 colour=punane result=punane mult=1 bal=119910
|
||||||
|
2026-03-20 12:36:33 | BUY user=344531774518591498 item=karikas cost=-6000 bal=54544
|
||||||
|
2026-03-20 12:36:37 | BUY user=344531774518591498 item=monitor_360 cost=-7500 bal=47044
|
||||||
|
2026-03-20 12:36:50 | BLACKJACK user=344531774518591498 payout=+0 net=-47044 bal=0
|
||||||
|
2026-03-20 12:37:18 | ROULETTE_WIN user=178852380018868224 bet=384584 colour=punane result=punane mult=1 bal=769168
|
||||||
|
2026-03-20 12:37:48 | ROULETTE_WIN user=178852380018868224 bet=769168 colour=punane result=punane mult=1 bal=1538336
|
||||||
|
2026-03-20 12:37:52 | ROULETTE_LOSE user=824516445382901800 bet=119910 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 12:39:40 | BUY user=272518654715887618 item=gaming_laptop cost=-1500 bal=59693
|
||||||
|
2026-03-20 12:39:51 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-167 robber_bal=0 ac_uses_left=1
|
||||||
|
2026-03-20 12:39:51 | BUY user=272518654715887618 item=cat6 cost=-3500 bal=56193
|
||||||
|
2026-03-20 12:39:55 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-100 robber_bal=0 ac_uses_left=0
|
||||||
|
2026-03-20 12:40:01 | ROB_WIN robber=401373976431165449 victim=178852380018868224 stolen=+162541 jackpot=False robber_bal=235777 victim_bal=1375795
|
||||||
|
2026-03-20 12:40:02 | ROB_WIN robber=824516445382901800 victim=178852380018868224 stolen=+340819 jackpot=False robber_bal=340819 victim_bal=1034976
|
||||||
|
2026-03-20 12:40:03 | BUY user=178852380018868224 item=anticheat cost=-1000 bal=1033976
|
||||||
|
2026-03-20 12:40:07 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-109 robber_bal=340710 ac_uses_left=1
|
||||||
|
2026-03-20 12:40:09 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-128 robber_bal=340582 ac_uses_left=0
|
||||||
|
2026-03-20 12:40:11 | ROB_FAIL robber=824516445382901800 victim=178852380018868224 fine=-188 robber_bal=340394
|
||||||
|
2026-03-20 12:40:12 | ROB_FAIL robber=824516445382901800 victim=178852380018868224 fine=-232 robber_bal=340162
|
||||||
|
2026-03-20 12:40:12 | BUY user=178852380018868224 item=anticheat cost=-1000 bal=1032976
|
||||||
|
2026-03-20 12:40:15 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-103 robber_bal=340059 ac_uses_left=1
|
||||||
|
2026-03-20 12:40:17 | BUY user=272518654715887618 item=lan_pass cost=-1200 bal=54993
|
||||||
|
2026-03-20 12:40:18 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-199 robber_bal=339860 ac_uses_left=0
|
||||||
|
2026-03-20 12:40:19 | BUY user=178852380018868224 item=anticheat cost=-1000 bal=1031976
|
||||||
|
2026-03-20 12:40:20 | ROB_BLOCKED robber=824516445382901800 victim=178852380018868224 fine=-100 robber_bal=339760 ac_uses_left=1
|
||||||
|
2026-03-20 12:40:23 | ROULETTE_LOSE user=178852380018868224 bet=1031976 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 12:40:27 | BUY user=272518654715887618 item=anticheat cost=-1000 bal=53993
|
||||||
|
2026-03-20 12:40:34 | BUY user=272518654715887618 item=reguleeritav_laud cost=-3500 bal=50493
|
||||||
|
2026-03-20 12:40:42 | BUY user=272518654715887618 item=jellyfin cost=-4000 bal=46493
|
||||||
|
2026-03-20 12:40:55 | BUY user=272518654715887618 item=monitor cost=-2500 bal=43993
|
||||||
|
2026-03-20 12:41:00 | ROB_BLOCKED robber=824516445382901800 victim=401373976431165449 fine=-139 robber_bal=339621 ac_uses_left=0
|
||||||
|
2026-03-20 12:41:02 | ROB_FAIL robber=824516445382901800 victim=401373976431165449 fine=-131 robber_bal=339490
|
||||||
|
2026-03-20 12:41:02 | WORK user=272518654715887618 earned=+97 lucky=False bal=44090
|
||||||
|
2026-03-20 12:41:04 | ROB_WIN robber=824516445382901800 victim=401373976431165449 stolen=+51444 jackpot=False robber_bal=390934 victim_bal=184333
|
||||||
|
2026-03-20 12:41:05 | ROB_BLOCKED robber=178852380018868224 victim=824516445382901800 fine=-179 robber_bal=0 ac_uses_left=0
|
||||||
|
2026-03-20 12:41:05 | ROB_WIN robber=824516445382901800 victim=401373976431165449 stolen=+41097 jackpot=False robber_bal=432031 victim_bal=143236
|
||||||
|
2026-03-20 12:41:05 | ROB_WIN robber=401373976431165449 victim=824516445382901800 stolen=+67489 jackpot=False robber_bal=210725 victim_bal=364542
|
||||||
|
2026-03-20 12:41:07 | ROB_WIN robber=178852380018868224 victim=824516445382901800 stolen=+76500 jackpot=False robber_bal=76500 victim_bal=288042
|
||||||
|
2026-03-20 12:41:08 | ROB_FAIL robber=178852380018868224 victim=824516445382901800 fine=-136 robber_bal=76364
|
||||||
|
2026-03-20 12:41:08 | ROB_WIN robber=824516445382901800 victim=401373976431165449 stolen=+50641 jackpot=False robber_bal=338683 victim_bal=160084
|
||||||
|
2026-03-20 12:41:10 | BUY user=401373976431165449 item=anticheat cost=-1000 bal=159084
|
||||||
|
2026-03-20 12:41:11 | ROB_WIN robber=178852380018868224 victim=824516445382901800 stolen=+41788 jackpot=False robber_bal=118152 victim_bal=296895
|
||||||
|
2026-03-20 12:41:11 | ROB_BLOCKED robber=824516445382901800 victim=401373976431165449 fine=-103 robber_bal=296792 ac_uses_left=1
|
||||||
|
2026-03-20 12:41:13 | ROULETTE_WIN user=178852380018868224 bet=118152 colour=punane result=punane mult=1 bal=236304
|
||||||
|
2026-03-20 12:41:13 | ROB_BLOCKED robber=824516445382901800 victim=401373976431165449 fine=-125 robber_bal=296667 ac_uses_left=0
|
||||||
|
2026-03-20 12:41:24 | BUY user=401373976431165449 item=anticheat cost=-1000 bal=158084
|
||||||
|
2026-03-20 12:41:24 | BEG user=272518654715887618 earned=+38 jailed=False bal=44128
|
||||||
|
2026-03-20 12:41:35 | BEG user=401373976431165449 earned=+74 jailed=False bal=158158
|
||||||
|
2026-03-20 12:41:54 | ROULETTE_WIN user=178852380018868224 bet=236304 colour=punane result=punane mult=1 bal=472608
|
||||||
|
2026-03-20 12:41:59 | BLACKJACK user=272518654715887618 payout=+40000 net=+20000 bal=64128
|
||||||
|
2026-03-20 12:42:01 | SLOTS_PAIR user=824516445382901800 bet=296667 change=148333 bal=445000
|
||||||
|
2026-03-20 12:42:43 | ROULETTE_LOSE user=178852380018868224 bet=472608 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 12:43:11 | SLOTS_PAIR user=338622999127261185 bet=60642 change=30321 bal=90963
|
||||||
|
2026-03-20 12:43:21 | BUY user=824516445382901800 item=anticheat cost=-1000 bal=444000
|
||||||
|
2026-03-20 12:43:28 | ROULETTE_WIN user=338622999127261185 bet=90963 colour=must result=must mult=1 bal=181926
|
||||||
|
2026-03-20 12:43:43 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=449000
|
||||||
|
2026-03-20 12:43:49 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=439000
|
||||||
|
2026-03-20 12:43:53 | WORK user=338622999127261185 earned=+61 lucky=False bal=181987
|
||||||
|
2026-03-20 12:43:54 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=444000
|
||||||
|
2026-03-20 12:43:55 | CRIME_FAIL user=338622999127261185 fine=-111 jailed=True bal=181876
|
||||||
|
2026-03-20 12:43:59 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=434000
|
||||||
|
2026-03-20 12:44:05 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=30000 bal=464000
|
||||||
|
2026-03-20 12:44:10 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=469000
|
||||||
|
2026-03-20 12:44:17 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=459000
|
||||||
|
2026-03-20 12:44:17 | BAIL_PAID user=338622999127261185 fine=-46087 pct=25% bal=135789
|
||||||
|
2026-03-20 12:44:22 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=449000
|
||||||
|
2026-03-20 12:44:25 | SLOTS_MISS user=338622999127261185 bet=135789 change=-135789 bal=0
|
||||||
|
2026-03-20 12:44:27 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=454000
|
||||||
|
2026-03-20 12:44:33 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=444000
|
||||||
|
2026-03-20 12:44:49 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=434000
|
||||||
|
2026-03-20 12:44:55 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=424000
|
||||||
|
2026-03-20 12:44:56 | BEG user=401373976431165449 earned=+20 jailed=False bal=158178
|
||||||
|
2026-03-20 12:45:02 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=30000 bal=454000
|
||||||
|
2026-03-20 12:45:08 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=60000 bal=514000
|
||||||
|
2026-03-20 12:45:13 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=519000
|
||||||
|
2026-03-20 12:45:20 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=509000
|
||||||
|
2026-03-20 12:45:25 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=30000 bal=539000
|
||||||
|
2026-03-20 12:45:30 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=544000
|
||||||
|
2026-03-20 12:45:35 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=534000
|
||||||
|
2026-03-20 12:45:42 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=524000
|
||||||
|
2026-03-20 12:45:47 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=514000
|
||||||
|
2026-03-20 12:45:57 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=504000
|
||||||
|
2026-03-20 12:46:02 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=494000
|
||||||
|
2026-03-20 12:46:07 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=499000
|
||||||
|
2026-03-20 12:46:12 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=504000
|
||||||
|
2026-03-20 12:46:18 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=509000
|
||||||
|
2026-03-20 12:46:22 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=499000
|
||||||
|
2026-03-20 12:46:28 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=489000
|
||||||
|
2026-03-20 12:46:33 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=494000
|
||||||
|
2026-03-20 12:46:40 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=484000
|
||||||
|
2026-03-20 12:46:45 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=489000
|
||||||
|
2026-03-20 12:46:50 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=30000 bal=519000
|
||||||
|
2026-03-20 12:46:56 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=509000
|
||||||
|
2026-03-20 12:47:02 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=514000
|
||||||
|
2026-03-20 12:47:07 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=519000
|
||||||
|
2026-03-20 12:47:13 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=509000
|
||||||
|
2026-03-20 12:47:21 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=514000
|
||||||
|
2026-03-20 12:47:27 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=504000
|
||||||
|
2026-03-20 12:47:33 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=494000
|
||||||
|
2026-03-20 12:47:38 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=90000 bal=584000
|
||||||
|
2026-03-20 12:47:43 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=589000
|
||||||
|
2026-03-20 12:47:48 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=594000
|
||||||
|
2026-03-20 12:47:55 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=584000
|
||||||
|
2026-03-20 12:48:00 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=40000 bal=624000
|
||||||
|
2026-03-20 12:48:06 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=614000
|
||||||
|
2026-03-20 12:48:12 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=619000
|
||||||
|
2026-03-20 12:48:18 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=40000 bal=659000
|
||||||
|
2026-03-20 12:48:20 | BEG user=401373976431165449 earned=+68 jailed=False bal=158246
|
||||||
|
2026-03-20 12:48:25 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=664000
|
||||||
|
2026-03-20 12:48:30 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=669000
|
||||||
|
2026-03-20 12:48:36 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=674000
|
||||||
|
2026-03-20 12:48:42 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=679000
|
||||||
|
2026-03-20 12:48:48 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=669000
|
||||||
|
2026-03-20 12:49:37 | ADMIN_JAIL admin=272518654715887618 target=401373976431165449 minutes=100 reason=Omavoliliselt
|
||||||
|
2026-03-20 12:51:31 | ADMIN_UNJAIL admin=272518654715887618 target=401373976431165449
|
||||||
|
2026-03-20 13:01:40 | BEG user=272518654715887618 earned=+10 jailed=False bal=64138
|
||||||
|
2026-03-20 13:02:01 | BLACKJACK user=272518654715887618 payout=+40000 net=+20000 bal=84138
|
||||||
|
2026-03-20 13:03:15 | BEG user=344531774518591498 earned=+78 jailed=False bal=78
|
||||||
|
2026-03-20 13:03:16 | WORK user=344531774518591498 earned=+120 lucky=False bal=198
|
||||||
|
2026-03-20 13:14:55 | BEG user=401373976431165449 earned=+70 jailed=False bal=158316
|
||||||
|
2026-03-20 13:14:58 | WORK user=401373976431165449 earned=+56 lucky=False bal=158372
|
||||||
|
2026-03-20 13:24:03 | BEG user=272518654715887618 earned=+40 jailed=False bal=84178
|
||||||
|
2026-03-20 13:24:12 | WORK user=272518654715887618 earned=+121 lucky=False bal=84299
|
||||||
|
2026-03-20 13:24:24 | BUY user=272518654715887618 item=energiajook cost=-800 bal=83499
|
||||||
|
2026-03-20 13:24:46 | BUY user=272518654715887618 item=mikrofon cost=-2800 bal=80699
|
||||||
|
2026-03-20 13:24:56 | BUY user=272518654715887618 item=klaviatuur cost=-1800 bal=78899
|
||||||
|
2026-03-20 13:25:12 | CRIME_FAIL user=272518654715887618 fine=-101 jailed=True bal=78798
|
||||||
|
2026-03-20 13:30:43 | BEG user=338622999127261185 earned=+70 jailed=False bal=70
|
||||||
|
2026-03-20 13:30:45 | WORK user=338622999127261185 earned=+109 lucky=False bal=179
|
||||||
|
2026-03-20 13:42:46 | CRIME_WIN user=401373976431165449 earned=+453 bal=158825
|
||||||
|
2026-03-20 13:44:12 | WORK user=344531774518591498 earned=+33 lucky=False bal=231
|
||||||
|
2026-03-20 13:44:14 | BEG user=344531774518591498 earned=+26 jailed=False bal=257
|
||||||
|
2026-03-20 14:45:12 | ROB_WIN robber=401373976431165449 victim=218972931701735424 stolen=+14535 jackpot=False robber_bal=173360 victim_bal=48236
|
||||||
|
2026-03-20 14:45:19 | WORK user=344531774518591498 earned=+88 lucky=False bal=345
|
||||||
|
2026-03-20 14:46:36 | ROB_BLOCKED robber=178852380018868224 victim=824516445382901800 fine=-142 robber_bal=0 ac_uses_left=1
|
||||||
|
2026-03-20 14:52:26 | WORK user=272518654715887618 earned=+88 lucky=False bal=78886
|
||||||
|
2026-03-20 14:52:30 | BEG user=272518654715887618 earned=+52 jailed=False bal=78938
|
||||||
|
2026-03-20 14:57:12 | BEG user=272518654715887618 earned=+80 jailed=False bal=79018
|
||||||
|
2026-03-20 15:17:52 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=679000
|
||||||
|
2026-03-20 15:17:58 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=659000
|
||||||
|
2026-03-20 15:18:05 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=639000
|
||||||
|
2026-03-20 15:18:10 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=649000
|
||||||
|
2026-03-20 15:18:15 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:18:21 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=639000
|
||||||
|
2026-03-20 15:18:27 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=649000
|
||||||
|
2026-03-20 15:18:33 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:18:38 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:18:45 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:18:50 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:18:55 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:19:03 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:19:08 | SLOTS_TRIPLE user=824516445382901800 bet=20000 change=60000 bal=709000
|
||||||
|
2026-03-20 15:19:13 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=689000
|
||||||
|
2026-03-20 15:19:18 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=669000
|
||||||
|
2026-03-20 15:19:23 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=679000
|
||||||
|
2026-03-20 15:19:30 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=689000
|
||||||
|
2026-03-20 15:19:47 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=669000
|
||||||
|
2026-03-20 15:19:53 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:19:58 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=629000
|
||||||
|
2026-03-20 15:20:03 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=639000
|
||||||
|
2026-03-20 15:20:08 | SLOTS_TRIPLE user=824516445382901800 bet=20000 change=80000 bal=719000
|
||||||
|
2026-03-20 15:20:13 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=699000
|
||||||
|
2026-03-20 15:20:20 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=679000
|
||||||
|
2026-03-20 15:20:25 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=659000
|
||||||
|
2026-03-20 15:20:30 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:20:35 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:20:40 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:20:47 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:20:53 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=679000
|
||||||
|
2026-03-20 15:20:58 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=689000
|
||||||
|
2026-03-20 15:21:03 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=669000
|
||||||
|
2026-03-20 15:21:10 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:21:16 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:21:23 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:21:32 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=679000
|
||||||
|
2026-03-20 15:21:37 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=689000
|
||||||
|
2026-03-20 15:21:43 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=669000
|
||||||
|
2026-03-20 15:21:48 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:21:53 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=659000
|
||||||
|
2026-03-20 15:22:00 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=669000
|
||||||
|
2026-03-20 15:22:05 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=649000
|
||||||
|
2026-03-20 15:22:10 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=629000
|
||||||
|
2026-03-20 15:22:15 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=609000
|
||||||
|
2026-03-20 15:22:20 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=589000
|
||||||
|
2026-03-20 15:22:25 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=569000
|
||||||
|
2026-03-20 15:22:31 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=549000
|
||||||
|
2026-03-20 15:22:36 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=559000
|
||||||
|
2026-03-20 15:22:41 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=539000
|
||||||
|
2026-03-20 15:23:15 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=529000
|
||||||
|
2026-03-20 15:23:20 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=519000
|
||||||
|
2026-03-20 15:23:26 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=524000
|
||||||
|
2026-03-20 15:23:31 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=514000
|
||||||
|
2026-03-20 15:23:36 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=519000
|
||||||
|
2026-03-20 15:23:41 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=509000
|
||||||
|
2026-03-20 15:23:48 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=514000
|
||||||
|
2026-03-20 15:23:53 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=519000
|
||||||
|
2026-03-20 15:23:58 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=524000
|
||||||
|
2026-03-20 15:24:03 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=514000
|
||||||
|
2026-03-20 15:24:10 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=504000
|
||||||
|
2026-03-20 15:24:18 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=494000
|
||||||
|
2026-03-20 15:24:23 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=484000
|
||||||
|
2026-03-20 15:24:30 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=489000
|
||||||
|
2026-03-20 15:24:35 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=479000
|
||||||
|
2026-03-20 15:24:40 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=469000
|
||||||
|
2026-03-20 15:24:46 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=459000
|
||||||
|
2026-03-20 15:24:51 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=464000
|
||||||
|
2026-03-20 15:24:56 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=454000
|
||||||
|
2026-03-20 15:25:03 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=444000
|
||||||
|
2026-03-20 15:25:09 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=434000
|
||||||
|
2026-03-20 15:25:16 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=424000
|
||||||
|
2026-03-20 15:25:21 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=414000
|
||||||
|
2026-03-20 15:25:28 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=419000
|
||||||
|
2026-03-20 15:25:35 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=409000
|
||||||
|
2026-03-20 15:25:40 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=414000
|
||||||
|
2026-03-20 15:25:46 | SLOTS_JACKPOT user=824516445382901800 bet=10000 change=240000 bal=654000
|
||||||
|
2026-03-20 15:25:53 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=659000
|
||||||
|
2026-03-20 15:25:58 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=664000
|
||||||
|
2026-03-20 15:26:03 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=140000 bal=804000
|
||||||
|
2026-03-20 15:28:09 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=809000
|
||||||
|
2026-03-20 15:28:14 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=799000
|
||||||
|
2026-03-20 15:28:19 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=804000
|
||||||
|
2026-03-20 15:28:25 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=794000
|
||||||
|
2026-03-20 15:28:32 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=799000
|
||||||
|
2026-03-20 15:29:08 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=804000
|
||||||
|
2026-03-20 15:29:14 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=794000
|
||||||
|
2026-03-20 15:29:21 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=799000
|
||||||
|
2026-03-20 15:29:26 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=789000
|
||||||
|
2026-03-20 15:29:31 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=40000 bal=829000
|
||||||
|
2026-03-20 15:29:36 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=819000
|
||||||
|
2026-03-20 15:29:41 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=824000
|
||||||
|
2026-03-20 15:29:47 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=829000
|
||||||
|
2026-03-20 15:29:56 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=834000
|
||||||
|
2026-03-20 15:30:02 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=839000
|
||||||
|
2026-03-20 15:30:07 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=844000
|
||||||
|
2026-03-20 15:30:15 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=834000
|
||||||
|
2026-03-20 15:30:32 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=839000
|
||||||
|
2026-03-20 15:30:38 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=829000
|
||||||
|
2026-03-20 15:30:43 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=834000
|
||||||
|
2026-03-20 15:31:35 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=839000
|
||||||
|
2026-03-20 15:31:40 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=844000
|
||||||
|
2026-03-20 15:31:46 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=849000
|
||||||
|
2026-03-20 15:31:53 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=839000
|
||||||
|
2026-03-20 15:31:58 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=844000
|
||||||
|
2026-03-20 15:32:03 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=834000
|
||||||
|
2026-03-20 15:32:09 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=824000
|
||||||
|
2026-03-20 15:32:14 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=814000
|
||||||
|
2026-03-20 15:32:20 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=804000
|
||||||
|
2026-03-20 15:32:26 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=794000
|
||||||
|
2026-03-20 15:32:31 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=799000
|
||||||
|
2026-03-20 15:32:36 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=804000
|
||||||
|
2026-03-20 15:32:41 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=794000
|
||||||
|
2026-03-20 15:32:48 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=784000
|
||||||
|
2026-03-20 15:32:53 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=774000
|
||||||
|
2026-03-20 15:33:09 | BUY user=824516445382901800 item=karikas cost=-6000 bal=768000
|
||||||
|
2026-03-20 15:33:13 | BUY user=824516445382901800 item=monitor_360 cost=-7500 bal=760500
|
||||||
|
2026-03-20 15:33:16 | BUY user=824516445382901800 item=gaming_tool cost=-9000 bal=751500
|
||||||
|
2026-03-20 15:35:01 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=761500
|
||||||
|
2026-03-20 15:35:08 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=771500
|
||||||
|
2026-03-20 15:35:14 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=781500
|
||||||
|
2026-03-20 15:35:20 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=761500
|
||||||
|
2026-03-20 15:35:25 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=771500
|
||||||
|
2026-03-20 15:35:30 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=751500
|
||||||
|
2026-03-20 15:35:35 | SLOTS_PAIR user=824516445382901800 bet=20000 change=10000 bal=761500
|
||||||
|
2026-03-20 15:35:42 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=741500
|
||||||
|
2026-03-20 15:35:47 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=721500
|
||||||
|
2026-03-20 15:35:52 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=701500
|
||||||
|
2026-03-20 15:35:57 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=681500
|
||||||
|
2026-03-20 15:36:02 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=661500
|
||||||
|
2026-03-20 15:36:07 | SLOTS_MISS user=824516445382901800 bet=20000 change=-20000 bal=641500
|
||||||
|
2026-03-20 15:36:12 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=646500
|
||||||
|
2026-03-20 15:36:17 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=651500
|
||||||
|
2026-03-20 15:36:22 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=641500
|
||||||
|
2026-03-20 15:36:28 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=631500
|
||||||
|
2026-03-20 15:36:33 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=621500
|
||||||
|
2026-03-20 15:36:40 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=626500
|
||||||
|
2026-03-20 15:36:45 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=616500
|
||||||
|
2026-03-20 15:36:53 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=621500
|
||||||
|
2026-03-20 15:36:58 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=611500
|
||||||
|
2026-03-20 15:37:03 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=601500
|
||||||
|
2026-03-20 15:37:09 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=606500
|
||||||
|
2026-03-20 15:37:14 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=611500
|
||||||
|
2026-03-20 15:37:20 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=601500
|
||||||
|
2026-03-20 15:37:27 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=606500
|
||||||
|
2026-03-20 15:37:32 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=611500
|
||||||
|
2026-03-20 15:37:40 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=601500
|
||||||
|
2026-03-20 15:37:47 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=591500
|
||||||
|
2026-03-20 15:37:52 | SLOTS_TRIPLE user=824516445382901800 bet=10000 change=60000 bal=651500
|
||||||
|
2026-03-20 15:37:57 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=641500
|
||||||
|
2026-03-20 15:38:06 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=631500
|
||||||
|
2026-03-20 15:38:12 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=636500
|
||||||
|
2026-03-20 15:38:18 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=626500
|
||||||
|
2026-03-20 15:38:24 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=616500
|
||||||
|
2026-03-20 15:38:29 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=621500
|
||||||
|
2026-03-20 15:38:35 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=611500
|
||||||
|
2026-03-20 15:38:40 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=616500
|
||||||
|
2026-03-20 15:42:05 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=606500
|
||||||
|
2026-03-20 15:42:12 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=596500
|
||||||
|
2026-03-20 15:42:18 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=586500
|
||||||
|
2026-03-20 15:42:24 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=576500
|
||||||
|
2026-03-20 15:42:29 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=566500
|
||||||
|
2026-03-20 15:42:36 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=556500
|
||||||
|
2026-03-20 15:42:41 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=546500
|
||||||
|
2026-03-20 15:42:46 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=551500
|
||||||
|
2026-03-20 15:42:51 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=556500
|
||||||
|
2026-03-20 15:42:57 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=561500
|
||||||
|
2026-03-20 15:46:36 | CRIME_WIN user=401373976431165449 earned=+304 bal=173664
|
||||||
|
2026-03-20 15:46:48 | WORK user=401373976431165449 earned=+410 lucky=True bal=174074
|
||||||
|
2026-03-20 15:46:50 | BEG user=401373976431165449 earned=+52 jailed=False bal=174126
|
||||||
|
2026-03-20 15:48:44 | WORK user=272518654715887618 earned=+93 lucky=False bal=79111
|
||||||
|
2026-03-20 15:49:06 | BLACKJACK user=272518654715887618 payout=+80000 net=+40000 bal=119111
|
||||||
|
2026-03-20 16:24:32 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=551500
|
||||||
|
2026-03-20 16:24:38 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=541500
|
||||||
|
2026-03-20 16:24:42 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=546500
|
||||||
|
2026-03-20 16:24:47 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=536500
|
||||||
|
2026-03-20 16:24:55 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=541500
|
||||||
|
2026-03-20 16:25:02 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=546500
|
||||||
|
2026-03-20 16:25:08 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=551500
|
||||||
|
2026-03-20 16:25:13 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=541500
|
||||||
|
2026-03-20 16:25:20 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=531500
|
||||||
|
2026-03-20 16:25:28 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=521500
|
||||||
|
2026-03-20 16:25:35 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=526500
|
||||||
|
2026-03-20 16:25:41 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=531500
|
||||||
|
2026-03-20 16:25:47 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=536500
|
||||||
|
2026-03-20 16:25:53 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=541500
|
||||||
|
2026-03-20 16:26:00 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=546500
|
||||||
|
2026-03-20 16:26:05 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=536500
|
||||||
|
2026-03-20 16:26:10 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=541500
|
||||||
|
2026-03-20 16:28:22 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=546500
|
||||||
|
2026-03-20 16:28:28 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=536500
|
||||||
|
2026-03-20 16:28:35 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=541500
|
||||||
|
2026-03-20 16:28:40 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=531500
|
||||||
|
2026-03-20 16:28:45 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=536500
|
||||||
|
2026-03-20 16:28:50 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=541500
|
||||||
|
2026-03-20 16:28:57 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=531500
|
||||||
|
2026-03-20 16:29:05 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=521500
|
||||||
|
2026-03-20 16:29:10 | SLOTS_MISS user=824516445382901800 bet=10000 change=-10000 bal=511500
|
||||||
|
2026-03-20 16:29:15 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=516500
|
||||||
|
2026-03-20 16:29:21 | SLOTS_PAIR user=824516445382901800 bet=10000 change=5000 bal=521500
|
||||||
|
2026-03-20 16:30:49 | WORK user=824516445382901800 earned=+140 lucky=False bal=521640
|
||||||
|
2026-03-20 16:30:50 | BEG user=824516445382901800 earned=+60 jailed=False bal=521700
|
||||||
|
2026-03-20 16:30:53 | CRIME_WIN user=824516445382901800 earned=+260 bal=521960
|
||||||
|
2026-03-20 16:31:06 | ROB_BLOCKED robber=824516445382901800 victim=272518654715887618 fine=-174 robber_bal=521786 ac_uses_left=1
|
||||||
|
2026-03-20 16:34:38 | BEG user=367347301322326016 earned=+15 jailed=False bal=217
|
||||||
|
2026-03-20 16:34:40 | WORK user=367347301322326016 earned=+43 lucky=False bal=260
|
||||||
|
2026-03-20 16:34:43 | CRIME_WIN user=367347301322326016 earned=+392 bal=652
|
||||||
|
2026-03-20 16:46:10 | BEG user=401373976431165449 earned=+62 jailed=False bal=174188
|
||||||
|
2026-03-20 16:46:12 | WORK user=401373976431165449 earned=+95 lucky=False bal=174283
|
||||||
|
2026-03-20 16:46:25 | ROB_BLOCKED robber=401373976431165449 victim=824516445382901800 fine=-197 robber_bal=174086 ac_uses_left=0
|
||||||
|
2026-03-20 16:46:35 | BUY user=824516445382901800 item=anticheat cost=-1000 bal=520786
|
||||||
|
2026-03-20 16:47:16 | GIVE from_=824516445382901800 to=450392724169031680 amount=520786 from_bal=0 to_bal=520786
|
||||||
|
2026-03-20 16:48:04 | HEIST_FAIL user=401373976431165449 fine=-1000 jailed_until=2026-03-20T16:18:04.449345+00:00 bal=173086
|
||||||
|
2026-03-20 16:48:04 | HEIST_FAIL user=824516445382901800 fine=-150 jailed_until=2026-03-20T16:18:04.449345+00:00 bal=0
|
||||||
|
2026-03-20 16:49:17 | BEG user=401373976431165449 earned=+26 jailed=True bal=173112
|
||||||
|
2026-03-20 16:49:59 | GIVE from_=450392724169031680 to=824516445382901800 amount=520786 from_bal=0 to_bal=520786
|
||||||
|
2026-03-20 16:52:08 | GIVE from_=824516445382901800 to=450392724169031680 amount=519786 from_bal=1000 to_bal=519786
|
||||||
|
2026-03-20 16:52:19 | BAIL_PAID user=824516445382901800 fine=-350 pct=24% bal=650
|
||||||
|
2026-03-20 16:54:04 | GIVE from_=450392724169031680 to=824516445382901800 amount=519786 from_bal=0 to_bal=520436
|
||||||
|
2026-03-20 16:56:31 | ROB_BLOCKED robber=178852380018868224 victim=824516445382901800 fine=-188 robber_bal=0 ac_uses_left=1
|
||||||
|
2026-03-20 16:57:43 | GIVE from_=824516445382901800 to=401373976431165449 amount=20000 from_bal=500436 to_bal=193112
|
||||||
|
2026-03-20 16:57:47 | GIVE from_=824516445382901800 to=272518654715887618 amount=20000 from_bal=480436 to_bal=139111
|
||||||
|
2026-03-20 16:57:54 | GIVE from_=824516445382901800 to=340451525799182357 amount=20000 from_bal=460436 to_bal=79955
|
||||||
|
2026-03-20 16:58:02 | GIVE from_=824516445382901800 to=218972931701735424 amount=20000 from_bal=440436 to_bal=68236
|
||||||
|
2026-03-20 16:58:18 | GIVE from_=824516445382901800 to=323906492073771019 amount=20000 from_bal=420436 to_bal=62761
|
||||||
|
2026-03-20 16:58:22 | GIVE from_=824516445382901800 to=367347301322326016 amount=20000 from_bal=400436 to_bal=20652
|
||||||
|
2026-03-20 16:58:31 | GIVE from_=824516445382901800 to=344531774518591498 amount=20000 from_bal=380436 to_bal=20345
|
||||||
|
2026-03-20 16:58:35 | GIVE from_=824516445382901800 to=209554152584380420 amount=20000 from_bal=360436 to_bal=20309
|
||||||
|
2026-03-20 16:58:42 | GIVE from_=824516445382901800 to=338622999127261185 amount=20000 from_bal=340436 to_bal=20179
|
||||||
|
2026-03-20 16:58:46 | ROULETTE_LOSE user=344531774518591498 bet=20345 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 16:59:01 | GIVE from_=824516445382901800 to=344531774518591498 amount=20000 from_bal=320436 to_bal=20000
|
||||||
|
2026-03-20 16:59:05 | GIVE from_=824516445382901800 to=240454469668569088 amount=20000 from_bal=300436 to_bal=20044
|
||||||
|
2026-03-20 16:59:09 | GIVE from_=824516445382901800 to=311132892795371520 amount=20000 from_bal=280436 to_bal=20000
|
||||||
|
2026-03-20 16:59:12 | GIVE from_=824516445382901800 to=178852380018868224 amount=20000 from_bal=260436 to_bal=20000
|
||||||
|
2026-03-20 16:59:24 | GIVE from_=824516445382901800 to=296322817941569537 amount=20000 from_bal=240436 to_bal=20000
|
||||||
|
2026-03-20 16:59:29 | GIVE from_=824516445382901800 to=485760228508565504 amount=20000 from_bal=220436 to_bal=20000
|
||||||
|
2026-03-20 16:59:34 | GIVE from_=824516445382901800 to=450392724169031680 amount=20000 from_bal=200436 to_bal=20000
|
||||||
|
2026-03-20 17:00:10 | ROULETTE_LOSE user=344531774518591498 bet=10000 colour=punane result=must mult=1 bal=10000
|
||||||
|
2026-03-20 17:00:34 | ROULETTE_WIN user=344531774518591498 bet=10000 colour=punane result=punane mult=1 bal=20000
|
||||||
|
2026-03-20 17:00:58 | ROULETTE_LOSE user=344531774518591498 bet=10000 colour=punane result=must mult=1 bal=10000
|
||||||
|
2026-03-20 17:01:14 | ROULETTE_LOSE user=344531774518591498 bet=10000 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 17:06:54 | BEG user=272518654715887618 earned=+20 jailed=False bal=139131
|
||||||
|
2026-03-20 17:06:56 | WORK user=272518654715887618 earned=+393 lucky=True bal=139524
|
||||||
|
2026-03-20 17:07:23 | BLACKJACK user=272518654715887618 payout=+0 net=-50000 bal=89524
|
||||||
|
2026-03-20 17:10:34 | BEG user=272518654715887618 earned=+30 jailed=False bal=89554
|
||||||
|
2026-03-20 17:10:40 | CRIME_FAIL user=272518654715887618 fine=-90 jailed=True bal=89464
|
||||||
|
2026-03-20 17:10:53 | JAIL_FREE user=272518654715887618 method=doubles
|
||||||
|
2026-03-20 17:16:58 | BEG user=272518654715887618 earned=+78 jailed=False bal=89542
|
||||||
|
2026-03-20 17:17:49 | ROULETTE_LOSE user=824516445382901800 bet=200436 colour=punane result=must mult=1 bal=0
|
||||||
|
2026-03-20 17:18:09 | BLACKJACK user=272518654715887618 payout=+179084 net=+89542 bal=179084
|
||||||
|
2026-03-20 17:18:37 | BLACKJACK user=272518654715887618 payout=+0 net=-179084 bal=0
|
||||||
|
2026-03-20 17:21:54 | BEG user=344531774518591498 earned=+14 jailed=False bal=14
|
||||||
|
2026-03-20 17:21:57 | WORK user=344531774518591498 earned=+56 lucky=False bal=70
|
||||||
|
2026-03-20 17:21:59 | BEG user=272518654715887618 earned=+39 jailed=False bal=39
|
||||||
|
2026-03-20 17:22:02 | DAILY user=344531774518591498 earned=+150 streak=1 bal=220
|
||||||
1088
logs/transactions.log.2026-03-16
Normal file
1088
logs/transactions.log.2026-03-16
Normal file
File diff suppressed because it is too large
Load Diff
1788
logs/transactions.log.2026-03-17
Normal file
1788
logs/transactions.log.2026-03-17
Normal file
File diff suppressed because it is too large
Load Diff
1630
logs/transactions.log.2026-03-18
Normal file
1630
logs/transactions.log.2026-03-18
Normal file
File diff suppressed because it is too large
Load Diff
1160
logs/transactions.log.2026-03-19
Normal file
1160
logs/transactions.log.2026-03-19
Normal file
File diff suppressed because it is too large
Load Diff
213
member_sync.py
Normal file
213
member_sync.py
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
"""Member synchronization logic - roles, nicknames, birthdays."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from datetime import datetime, date
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
|
import discord
|
||||||
|
|
||||||
|
import config
|
||||||
|
import sheets
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
_PLACEHOLDER = {"-", "x", "n/a", "none", "ei"}
|
||||||
|
|
||||||
|
|
||||||
|
def _is_placeholder(val: str) -> bool:
|
||||||
|
"""Return True if a sheet cell value is an intentional empty marker."""
|
||||||
|
return not val.strip() or val.strip().lower() in _PLACEHOLDER
|
||||||
|
|
||||||
|
|
||||||
|
# Maps sheet role values to Discord role names where they differ
|
||||||
|
ROLE_NAME_MAP: dict[str, str] = {
|
||||||
|
"Juht": "Tiimijuht",
|
||||||
|
"Admin": "+",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SyncResult:
|
||||||
|
"""Tracks what happened during a sync operation."""
|
||||||
|
nickname_changed: bool = False
|
||||||
|
roles_added: list[str] = field(default_factory=list)
|
||||||
|
roles_removed: list[str] = field(default_factory=list)
|
||||||
|
birthday_soon: bool = False
|
||||||
|
not_found: bool = False
|
||||||
|
errors: list[str] = field(default_factory=list)
|
||||||
|
synced: bool = False # True when no errors; caller writes this to the sheet
|
||||||
|
|
||||||
|
@property
|
||||||
|
def changed(self) -> bool:
|
||||||
|
return self.nickname_changed or self.roles_added or self.roles_removed
|
||||||
|
|
||||||
|
|
||||||
|
def _format_nickname(full_name: str) -> str:
|
||||||
|
"""Format a nickname from a full name: first name + last name initial.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
'Mari Tamm' -> 'Mari T'
|
||||||
|
'Mari-Liis Tamm' -> 'Mari-Liis T'
|
||||||
|
'Jaan' -> 'Jaan'
|
||||||
|
"""
|
||||||
|
parts = full_name.strip().split()
|
||||||
|
if len(parts) < 2:
|
||||||
|
return full_name.strip()
|
||||||
|
first = parts[0] # preserves hyphenated names like Mari-Liis
|
||||||
|
last_initial = parts[-1][0].upper()
|
||||||
|
return f"{first} {last_initial}"
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_roles(roles_str: str) -> list[str]:
|
||||||
|
"""Parse comma-separated role names from the sheet."""
|
||||||
|
if not roles_str:
|
||||||
|
return []
|
||||||
|
return [r.strip().rstrip(".,;:!?") for r in str(roles_str).split(",") if r.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_birthday(raw: str) -> date | None:
|
||||||
|
"""Parse a birthday string robustly. Returns None for garbage/placeholder values."""
|
||||||
|
raw = str(raw).strip()
|
||||||
|
if _is_placeholder(raw):
|
||||||
|
return None
|
||||||
|
today = date.today()
|
||||||
|
for fmt, has_year in [("%d/%m/%Y", True), ("%Y-%m-%d", True), ("%m-%d", False)]:
|
||||||
|
try:
|
||||||
|
parsed = datetime.strptime(raw, fmt).date()
|
||||||
|
if has_year and not (1920 <= parsed.year <= today.year):
|
||||||
|
return None # unrealistic year (formula artefact, future year, etc.)
|
||||||
|
return parsed if has_year else parsed.replace(year=today.year)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _is_birthday_soon(birthday_str: str, window_days: int | None = None) -> bool:
|
||||||
|
"""Check if a birthday falls within the configured window."""
|
||||||
|
bday = _parse_birthday(birthday_str)
|
||||||
|
if bday is None:
|
||||||
|
return False
|
||||||
|
window = window_days or config.BIRTHDAY_WINDOW_DAYS
|
||||||
|
today = date.today()
|
||||||
|
this_year_bday = bday.replace(year=today.year)
|
||||||
|
if this_year_bday < today:
|
||||||
|
this_year_bday = bday.replace(year=today.year + 1)
|
||||||
|
delta = (this_year_bday - today).days
|
||||||
|
return 0 <= delta <= window
|
||||||
|
|
||||||
|
|
||||||
|
def is_birthday_today(birthday_str: str) -> bool:
|
||||||
|
"""Return True if today is the member's birthday (any supported date format)."""
|
||||||
|
bday = _parse_birthday(birthday_str)
|
||||||
|
if bday is None:
|
||||||
|
return False
|
||||||
|
today = date.today()
|
||||||
|
return bday.month == today.month and bday.day == today.day
|
||||||
|
|
||||||
|
|
||||||
|
async def sync_member(
|
||||||
|
member: discord.Member,
|
||||||
|
guild: discord.Guild,
|
||||||
|
) -> SyncResult:
|
||||||
|
"""Synchronize a single member's nickname and roles based on sheet data.
|
||||||
|
|
||||||
|
Also populates Discord ID in the sheet if missing, and updates username.
|
||||||
|
Returns a SyncResult describing what happened.
|
||||||
|
"""
|
||||||
|
result = SyncResult()
|
||||||
|
|
||||||
|
# Look up member in sheet cache
|
||||||
|
row = sheets.find_member(member.id, member.name)
|
||||||
|
if row is None:
|
||||||
|
result.not_found = True
|
||||||
|
return result
|
||||||
|
|
||||||
|
# --- Backfill User ID if missing ---
|
||||||
|
raw_id = str(row.get("User ID", "")).strip()
|
||||||
|
if not raw_id or raw_id == "0":
|
||||||
|
sheets.set_user_id(member.name, member.id)
|
||||||
|
|
||||||
|
# --- Update Discord username in sheet if it changed ---
|
||||||
|
sheet_username = str(row.get("Discord", "")).strip()
|
||||||
|
if sheet_username.lower() != member.name.lower():
|
||||||
|
sheets.update_username(member.id, member.name)
|
||||||
|
|
||||||
|
# --- Nickname (Nimi = real name, formatted as first name + last initial) ---
|
||||||
|
nimi = str(row.get("Nimi", "")).strip()
|
||||||
|
desired_nick = _format_nickname(nimi) if nimi else None
|
||||||
|
if desired_nick and member.nick != desired_nick:
|
||||||
|
try:
|
||||||
|
await member.edit(nick=desired_nick)
|
||||||
|
result.nickname_changed = True
|
||||||
|
except discord.Forbidden:
|
||||||
|
log.debug("No permission to set nickname for %s (likely admin), skipping", member)
|
||||||
|
except discord.HTTPException as e:
|
||||||
|
result.errors.append(f"Hüüdnime viga kasutajale {member}: {e}")
|
||||||
|
|
||||||
|
# --- Roles (from Organisatsioon, Valdkond, Roll columns; values may be comma-separated) ---
|
||||||
|
desired_role_names: list[str] = []
|
||||||
|
for col in ("Organisatsioon", "Valdkond", "Roll"):
|
||||||
|
val = str(row.get(col, "")).strip()
|
||||||
|
if not _is_placeholder(val):
|
||||||
|
desired_role_names.extend(
|
||||||
|
r for r in _parse_roles(val)
|
||||||
|
if not _is_placeholder(r)
|
||||||
|
)
|
||||||
|
desired_roles: list[discord.Role] = []
|
||||||
|
for rname in desired_role_names:
|
||||||
|
rname = ROLE_NAME_MAP.get(rname, rname)
|
||||||
|
role = discord.utils.get(guild.roles, name=rname)
|
||||||
|
if role:
|
||||||
|
desired_roles.append(role)
|
||||||
|
else:
|
||||||
|
result.errors.append(f"Rolli '{rname}' ei leitud serverist")
|
||||||
|
|
||||||
|
# Base roles that every synced member must have
|
||||||
|
for rid in config.BASE_ROLE_IDS:
|
||||||
|
role = guild.get_role(rid)
|
||||||
|
if role:
|
||||||
|
desired_roles.append(role)
|
||||||
|
else:
|
||||||
|
result.errors.append(f"Baasrolli ID {rid} ei leitud serverist")
|
||||||
|
|
||||||
|
# Roles to add (desired but member doesn't have)
|
||||||
|
to_add = [r for r in desired_roles if r not in member.roles]
|
||||||
|
# (we currently only ADD the desired roles, not remove extras - safe default)
|
||||||
|
|
||||||
|
if to_add:
|
||||||
|
try:
|
||||||
|
await member.add_roles(*to_add, reason="Sheet sync")
|
||||||
|
result.roles_added = [r.name for r in to_add]
|
||||||
|
except discord.Forbidden:
|
||||||
|
log.debug("No permission to add roles for %s (likely admin), skipping", member)
|
||||||
|
except discord.HTTPException as e:
|
||||||
|
result.errors.append(f"Rolli viga kasutajale {member}: {e}")
|
||||||
|
|
||||||
|
# --- Birthday check ---
|
||||||
|
birthday_str = str(row.get("Sünnipäev", "")).strip()
|
||||||
|
if not _is_placeholder(birthday_str) and _is_birthday_soon(birthday_str):
|
||||||
|
result.birthday_soon = True
|
||||||
|
|
||||||
|
# --- Mark synced (caller is responsible for writing to sheet) ---
|
||||||
|
result.synced = not bool(result.errors)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
async def announce_birthday(
|
||||||
|
member: discord.Member,
|
||||||
|
bot: discord.Client,
|
||||||
|
) -> None:
|
||||||
|
"""Send a birthday-coming-soon announcement to the configured channel."""
|
||||||
|
channel = bot.get_channel(config.BIRTHDAY_CHANNEL_ID)
|
||||||
|
if channel is None:
|
||||||
|
log.warning("Birthday channel %s not found", config.BIRTHDAY_CHANNEL_ID)
|
||||||
|
return
|
||||||
|
|
||||||
|
row = sheets.find_member(member.id, member.name)
|
||||||
|
bday_str = str(row.get("Sünnipäev", "")) if row else "?"
|
||||||
|
|
||||||
|
await channel.send(
|
||||||
|
f"🎂 @here **{member.display_name}** sünnipäev on täna! 🥳 Palju-palju õnne sünnipäevaks! 🎉"
|
||||||
|
)
|
||||||
152
pb_client.py
Normal file
152
pb_client.py
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
"""Async PocketBase REST client for TipiLAN Bot.
|
||||||
|
|
||||||
|
Handles admin authentication (auto-refreshed), and CRUD operations on the
|
||||||
|
economy_users collection. Uses aiohttp, which discord.py already depends on.
|
||||||
|
|
||||||
|
Environment variables (set in .env):
|
||||||
|
PB_URL Base URL of PocketBase (default: http://127.0.0.1:8090)
|
||||||
|
PB_ADMIN_EMAIL PocketBase admin e-mail
|
||||||
|
PB_ADMIN_PASSWORD PocketBase admin password
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import aiohttp
|
||||||
|
|
||||||
|
_log = logging.getLogger("tipiCOIN.pb")
|
||||||
|
|
||||||
|
PB_URL = os.getenv("PB_URL", "http://127.0.0.1:8090")
|
||||||
|
PB_ADMIN_EMAIL = os.getenv("PB_ADMIN_EMAIL", "")
|
||||||
|
PB_ADMIN_PASSWORD = os.getenv("PB_ADMIN_PASSWORD", "")
|
||||||
|
ECONOMY_COLLECTION = "economy_users"
|
||||||
|
|
||||||
|
_TIMEOUT = aiohttp.ClientTimeout(total=10)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Persistent session (created once, reused for the lifetime of the process)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
_session: aiohttp.ClientSession | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def _get_session() -> aiohttp.ClientSession:
|
||||||
|
global _session
|
||||||
|
if _session is None or _session.closed:
|
||||||
|
_session = aiohttp.ClientSession(timeout=_TIMEOUT)
|
||||||
|
return _session
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Auth token cache
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
_token: str = ""
|
||||||
|
_token_expiry: float = 0.0
|
||||||
|
_auth_lock = asyncio.Lock()
|
||||||
|
|
||||||
|
|
||||||
|
async def _ensure_auth() -> str:
|
||||||
|
global _token, _token_expiry
|
||||||
|
async with _auth_lock:
|
||||||
|
if time.monotonic() < _token_expiry:
|
||||||
|
return _token
|
||||||
|
session = _get_session()
|
||||||
|
async with session.post(
|
||||||
|
f"{PB_URL}/api/collections/_superusers/auth-with-password",
|
||||||
|
json={"identity": PB_ADMIN_EMAIL, "password": PB_ADMIN_PASSWORD},
|
||||||
|
) as resp:
|
||||||
|
if resp.status != 200:
|
||||||
|
text = await resp.text()
|
||||||
|
raise RuntimeError(f"PocketBase auth failed ({resp.status}): {text}")
|
||||||
|
data = await resp.json()
|
||||||
|
_token = data["token"]
|
||||||
|
_token_expiry = time.monotonic() + 13 * 24 * 3600 # refresh well before expiry
|
||||||
|
_log.debug("PocketBase admin token refreshed")
|
||||||
|
return _token
|
||||||
|
|
||||||
|
|
||||||
|
async def _hdrs() -> dict[str, str]:
|
||||||
|
return {"Authorization": await _ensure_auth()}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# CRUD helpers
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
async def get_record(user_id: str) -> dict[str, Any] | None:
|
||||||
|
"""Fetch one economy record by Discord user_id. Returns None if not found."""
|
||||||
|
session = _get_session()
|
||||||
|
async with session.get(
|
||||||
|
f"{PB_URL}/api/collections/{ECONOMY_COLLECTION}/records",
|
||||||
|
params={"filter": f'user_id="{user_id}"', "perPage": 1},
|
||||||
|
headers=await _hdrs(),
|
||||||
|
) as resp:
|
||||||
|
resp.raise_for_status()
|
||||||
|
data = await resp.json()
|
||||||
|
items = data.get("items", [])
|
||||||
|
return items[0] if items else None
|
||||||
|
|
||||||
|
|
||||||
|
async def create_record(record: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
"""Create a new economy record. Returns the created record (includes PB id)."""
|
||||||
|
session = _get_session()
|
||||||
|
async with session.post(
|
||||||
|
f"{PB_URL}/api/collections/{ECONOMY_COLLECTION}/records",
|
||||||
|
json=record,
|
||||||
|
headers=await _hdrs(),
|
||||||
|
) as resp:
|
||||||
|
if resp.status not in (200, 201):
|
||||||
|
text = await resp.text()
|
||||||
|
raise RuntimeError(f"PocketBase create failed ({resp.status}): {text}")
|
||||||
|
return await resp.json()
|
||||||
|
|
||||||
|
|
||||||
|
async def update_record(record_id: str, data: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
"""PATCH an existing record by its PocketBase record id."""
|
||||||
|
session = _get_session()
|
||||||
|
async with session.patch(
|
||||||
|
f"{PB_URL}/api/collections/{ECONOMY_COLLECTION}/records/{record_id}",
|
||||||
|
json=data,
|
||||||
|
headers=await _hdrs(),
|
||||||
|
) as resp:
|
||||||
|
resp.raise_for_status()
|
||||||
|
return await resp.json()
|
||||||
|
|
||||||
|
|
||||||
|
async def count_records() -> int:
|
||||||
|
"""Return the total number of records in the collection (single cheap request)."""
|
||||||
|
session = _get_session()
|
||||||
|
async with session.get(
|
||||||
|
f"{PB_URL}/api/collections/{ECONOMY_COLLECTION}/records",
|
||||||
|
params={"perPage": 1, "page": 1},
|
||||||
|
headers=await _hdrs(),
|
||||||
|
) as resp:
|
||||||
|
resp.raise_for_status()
|
||||||
|
data = await resp.json()
|
||||||
|
return int(data.get("totalItems", 0))
|
||||||
|
|
||||||
|
|
||||||
|
async def list_all_records(page_size: int = 500) -> list[dict[str, Any]]:
|
||||||
|
"""Fetch every record in the collection, handling PocketBase pagination."""
|
||||||
|
results: list[dict[str, Any]] = []
|
||||||
|
page = 1
|
||||||
|
session = _get_session()
|
||||||
|
hdrs = await _hdrs()
|
||||||
|
while True:
|
||||||
|
async with session.get(
|
||||||
|
f"{PB_URL}/api/collections/{ECONOMY_COLLECTION}/records",
|
||||||
|
params={"perPage": page_size, "page": page},
|
||||||
|
headers=hdrs,
|
||||||
|
) as resp:
|
||||||
|
resp.raise_for_status()
|
||||||
|
data = await resp.json()
|
||||||
|
batch = data.get("items", [])
|
||||||
|
results.extend(batch)
|
||||||
|
if len(batch) < page_size:
|
||||||
|
break
|
||||||
|
page += 1
|
||||||
|
return results
|
||||||
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
discord.py>=2.3.0
|
||||||
|
aiohttp>=3.9.0
|
||||||
|
gspread>=6.0.0
|
||||||
|
google-auth>=2.20.0
|
||||||
|
python-dotenv>=1.0.0
|
||||||
|
tzdata>=2024.1
|
||||||
|
colorlog>=6.8.0
|
||||||
|
psutil>=5.9.0
|
||||||
132
scripts/add_stats_fields.py
Normal file
132
scripts/add_stats_fields.py
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
"""Add new schema fields to the economy_users PocketBase collection.
|
||||||
|
|
||||||
|
Run once after pulling the stats + jailbreak_used changes:
|
||||||
|
python scripts/add_stats_fields.py
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
- PocketBase running and reachable at PB_URL
|
||||||
|
- PB_ADMIN_EMAIL / PB_ADMIN_PASSWORD set in .env
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import aiohttp
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
PB_URL = os.getenv("PB_URL", "http://127.0.0.1:8090")
|
||||||
|
PB_ADMIN_EMAIL = os.getenv("PB_ADMIN_EMAIL", "")
|
||||||
|
PB_ADMIN_PASSWORD = os.getenv("PB_ADMIN_PASSWORD", "")
|
||||||
|
COLLECTION = "economy_users"
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# New fields to add
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
_NEW_BOOL_FIELDS = [
|
||||||
|
"jailbreak_used",
|
||||||
|
]
|
||||||
|
|
||||||
|
_NEW_NUMBER_FIELDS = [
|
||||||
|
"heist_global_cd_until",
|
||||||
|
"peak_balance",
|
||||||
|
"lifetime_earned",
|
||||||
|
"lifetime_lost",
|
||||||
|
"work_count",
|
||||||
|
"beg_count",
|
||||||
|
"total_wagered",
|
||||||
|
"biggest_win",
|
||||||
|
"biggest_loss",
|
||||||
|
"slots_jackpots",
|
||||||
|
"crimes_attempted",
|
||||||
|
"crimes_succeeded",
|
||||||
|
"times_jailed",
|
||||||
|
"total_bail_paid",
|
||||||
|
"heists_joined",
|
||||||
|
"heists_won",
|
||||||
|
"total_given",
|
||||||
|
"total_received",
|
||||||
|
"best_daily_streak",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _number_field(name: str) -> dict:
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"type": "number",
|
||||||
|
"required": False,
|
||||||
|
"options": {"min": None, "max": None, "noDecimal": True},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _bool_field(name: str) -> dict:
|
||||||
|
return {"name": name, "type": "bool", "required": False}
|
||||||
|
|
||||||
|
|
||||||
|
async def main() -> None:
|
||||||
|
timeout = aiohttp.ClientTimeout(total=15)
|
||||||
|
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||||
|
# ── Authenticate ────────────────────────────────────────────────────
|
||||||
|
async with session.post(
|
||||||
|
f"{PB_URL}/api/collections/_superusers/auth-with-password",
|
||||||
|
json={"identity": PB_ADMIN_EMAIL, "password": PB_ADMIN_PASSWORD},
|
||||||
|
) as resp:
|
||||||
|
if resp.status != 200:
|
||||||
|
print(f"Auth failed ({resp.status}): {await resp.text()}")
|
||||||
|
return
|
||||||
|
token = (await resp.json())["token"]
|
||||||
|
|
||||||
|
hdrs = {"Authorization": token}
|
||||||
|
|
||||||
|
# ── Fetch current collection ─────────────────────────────────────────
|
||||||
|
async with session.get(
|
||||||
|
f"{PB_URL}/api/collections/{COLLECTION}", headers=hdrs
|
||||||
|
) as resp:
|
||||||
|
if resp.status != 200:
|
||||||
|
print(f"Could not fetch collection ({resp.status}): {await resp.text()}")
|
||||||
|
return
|
||||||
|
col = await resp.json()
|
||||||
|
|
||||||
|
existing = {f["name"] for f in col.get("fields", [])}
|
||||||
|
print(f"Existing fields ({len(existing)}): {sorted(existing)}\n")
|
||||||
|
|
||||||
|
new_fields = []
|
||||||
|
for name in _NEW_BOOL_FIELDS:
|
||||||
|
if name not in existing:
|
||||||
|
new_fields.append(_bool_field(name))
|
||||||
|
print(f" + {name} (bool)")
|
||||||
|
else:
|
||||||
|
print(f" = {name} (already exists)")
|
||||||
|
|
||||||
|
for name in _NEW_NUMBER_FIELDS:
|
||||||
|
if name not in existing:
|
||||||
|
new_fields.append(_number_field(name))
|
||||||
|
print(f" + {name} (number)")
|
||||||
|
else:
|
||||||
|
print(f" = {name} (already exists)")
|
||||||
|
|
||||||
|
if not new_fields:
|
||||||
|
print("\nNothing to add - schema already up to date.")
|
||||||
|
return
|
||||||
|
|
||||||
|
# ── Patch collection schema ──────────────────────────────────────────
|
||||||
|
updated_fields = col.get("fields", []) + new_fields
|
||||||
|
async with session.patch(
|
||||||
|
f"{PB_URL}/api/collections/{COLLECTION}",
|
||||||
|
json={"fields": updated_fields},
|
||||||
|
headers=hdrs,
|
||||||
|
) as resp:
|
||||||
|
if resp.status != 200:
|
||||||
|
print(f"\nSchema update failed ({resp.status}): {await resp.text()}")
|
||||||
|
return
|
||||||
|
print(f"\n✅ Added {len(new_fields)} field(s) successfully.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
76
scripts/migrate_to_pb.py
Normal file
76
scripts/migrate_to_pb.py
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
"""One-time migration: copy data/economy.json → PocketBase.
|
||||||
|
|
||||||
|
Run this ONCE after setting up PocketBase and before starting the bot with
|
||||||
|
the new PocketBase backend.
|
||||||
|
|
||||||
|
Usage (run from project root):
|
||||||
|
python scripts/migrate_to_pb.py
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
- PocketBase must be running and reachable at PB_URL
|
||||||
|
- PB_ADMIN_EMAIL and PB_ADMIN_PASSWORD must be set in .env
|
||||||
|
- The 'economy_users' collection must already exist in PocketBase
|
||||||
|
(see README or PocketBase admin UI to create it)
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# Ensure the project root is on sys.path so pb_client can be imported
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
import pb_client # noqa: E402 (needs dotenv loaded first)
|
||||||
|
|
||||||
|
DATA_FILE = Path("data") / "economy.json"
|
||||||
|
|
||||||
|
|
||||||
|
async def main() -> None:
|
||||||
|
if not DATA_FILE.exists():
|
||||||
|
print(f"[ERROR] {DATA_FILE} not found - nothing to migrate.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
raw: dict[str, dict] = json.loads(DATA_FILE.read_text(encoding="utf-8"))
|
||||||
|
total = len(raw)
|
||||||
|
print(f"Found {total} user(s) in {DATA_FILE}")
|
||||||
|
|
||||||
|
created = skipped = errors = 0
|
||||||
|
|
||||||
|
for uid, user in raw.items():
|
||||||
|
try:
|
||||||
|
record = dict(user)
|
||||||
|
record["user_id"] = uid
|
||||||
|
record.setdefault("balance", 0)
|
||||||
|
record.setdefault("exp", 0)
|
||||||
|
record.setdefault("items", [])
|
||||||
|
record.setdefault("item_uses", {})
|
||||||
|
record.setdefault("reminders", ["daily", "work", "beg", "crime", "rob"])
|
||||||
|
record.setdefault("eco_banned", False)
|
||||||
|
record.setdefault("daily_streak", 0)
|
||||||
|
|
||||||
|
existing = await pb_client.get_record(uid)
|
||||||
|
if existing:
|
||||||
|
await pb_client.update_record(existing["id"], record)
|
||||||
|
print(f" [UPDATE] {uid}")
|
||||||
|
skipped += 1 # reuse skipped counter as "updated"
|
||||||
|
else:
|
||||||
|
await pb_client.create_record(record)
|
||||||
|
print(f" [CREATE] {uid}")
|
||||||
|
created += 1
|
||||||
|
except Exception as exc:
|
||||||
|
print(f" [ERROR] {uid}: {exc}")
|
||||||
|
errors += 1
|
||||||
|
|
||||||
|
print(f"\nDone. Created: {created} Skipped: {skipped} Errors: {errors}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
216
sheets.py
Normal file
216
sheets.py
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
"""Google Sheets integration - read/write member data via gspread."""
|
||||||
|
|
||||||
|
import gspread
|
||||||
|
from google.oauth2.service_account import Credentials
|
||||||
|
|
||||||
|
import config
|
||||||
|
|
||||||
|
# Scopes needed: read + write to Sheets
|
||||||
|
SCOPES = [
|
||||||
|
"https://www.googleapis.com/auth/spreadsheets",
|
||||||
|
"https://www.googleapis.com/auth/drive",
|
||||||
|
]
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Expected sheet columns (header row):
|
||||||
|
# Nimi | Organisatsioon | Meil | Discord | User ID | Sünnipäev |
|
||||||
|
# Telefon | Valdkond | Roll | Discordis synced? | Groupi lisatud?
|
||||||
|
#
|
||||||
|
# - Nimi : member's real name (used as Discord nickname)
|
||||||
|
# - Organisatsioon : organisation value - maps to a Discord role
|
||||||
|
# - Meil : email address (read-only for bot)
|
||||||
|
# - Discord : Discord username for initial matching
|
||||||
|
# - User ID : numeric Discord user ID (bot can populate this)
|
||||||
|
# - Sünnipäev : birthday date string (YYYY-MM-DD or MM-DD)
|
||||||
|
# - Telefon : phone number (read-only for bot)
|
||||||
|
# - Valdkond : field/area value - maps to a Discord role
|
||||||
|
# - Roll : role value - maps to a Discord role
|
||||||
|
# - Discordis synced? : TRUE/FALSE - bot writes this after confirming sync
|
||||||
|
# - Groupi lisatud? : group membership flag (managed externally)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
EXPECTED_HEADERS = [
|
||||||
|
"Nimi",
|
||||||
|
"Organisatsioon",
|
||||||
|
"Meil",
|
||||||
|
"Discord",
|
||||||
|
"User ID",
|
||||||
|
"Sünnipäev",
|
||||||
|
"Telefon",
|
||||||
|
"Valdkond",
|
||||||
|
"Roll",
|
||||||
|
"Discordis synced?",
|
||||||
|
"Groupi lisatud?",
|
||||||
|
]
|
||||||
|
|
||||||
|
_client: gspread.Client | None = None
|
||||||
|
_worksheet: gspread.Worksheet | None = None
|
||||||
|
|
||||||
|
# In-memory cache: list of dicts (one per row)
|
||||||
|
_cache: list[dict] = []
|
||||||
|
|
||||||
|
|
||||||
|
def _get_worksheet() -> gspread.Worksheet:
|
||||||
|
"""Authenticate and return the first worksheet of the configured sheet."""
|
||||||
|
global _client, _worksheet
|
||||||
|
creds = Credentials.from_service_account_file(config.GOOGLE_CREDS_PATH, scopes=SCOPES)
|
||||||
|
_client = gspread.authorize(creds)
|
||||||
|
spreadsheet = _client.open_by_key(config.SHEET_ID)
|
||||||
|
_worksheet = spreadsheet.sheet1
|
||||||
|
return _worksheet
|
||||||
|
|
||||||
|
|
||||||
|
def _ensure_headers(ws: gspread.Worksheet) -> None:
|
||||||
|
"""If the sheet is empty or missing headers, write them (headers are in row 1)."""
|
||||||
|
existing = ws.row_values(1)
|
||||||
|
if existing != EXPECTED_HEADERS:
|
||||||
|
for col_idx, header in enumerate(EXPECTED_HEADERS, start=1):
|
||||||
|
if col_idx > len(existing) or existing[col_idx - 1] != header:
|
||||||
|
ws.update_cell(1, col_idx, header)
|
||||||
|
|
||||||
|
|
||||||
|
def refresh() -> list[dict]:
|
||||||
|
"""Pull all rows from the sheet into the in-memory cache.
|
||||||
|
|
||||||
|
Returns the cache (list of dicts keyed by header names).
|
||||||
|
"""
|
||||||
|
global _cache
|
||||||
|
ws = _get_worksheet()
|
||||||
|
_ensure_headers(ws)
|
||||||
|
# head=1: row 1 is the header; row 2 is a formula/stats row - skip it
|
||||||
|
records = ws.get_all_records(head=1)
|
||||||
|
_cache = records[1:] # drop the formula row (row 2) from the cache
|
||||||
|
return _cache
|
||||||
|
|
||||||
|
|
||||||
|
def get_cache() -> list[dict]:
|
||||||
|
"""Return the current in-memory cache without re-querying."""
|
||||||
|
return _cache
|
||||||
|
|
||||||
|
|
||||||
|
def find_member_by_id(discord_id: int) -> dict | None:
|
||||||
|
"""Look up a member row by Discord user ID."""
|
||||||
|
for row in _cache:
|
||||||
|
raw = row.get("User ID", "")
|
||||||
|
if str(raw).strip() == str(discord_id):
|
||||||
|
return row
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def find_member_by_username(username: str) -> dict | None:
|
||||||
|
"""Look up a member row by Discord username (case-insensitive)."""
|
||||||
|
for row in _cache:
|
||||||
|
if str(row.get("Discord", "")).strip().lower() == username.lower():
|
||||||
|
return row
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def find_member(discord_id: int, username: str) -> dict | None:
|
||||||
|
"""Try ID first, fall back to username."""
|
||||||
|
return find_member_by_id(discord_id) or find_member_by_username(username)
|
||||||
|
|
||||||
|
|
||||||
|
# ---- Write helpers --------------------------------------------------------
|
||||||
|
|
||||||
|
def _row_index_for_member(discord_id: int | None = None, username: str | None = None) -> int | None:
|
||||||
|
"""Return the 1-based sheet row index for a member (header = row 2, data from row 3)."""
|
||||||
|
for idx, row in enumerate(_cache):
|
||||||
|
if discord_id and str(row.get("User ID", "")).strip() == str(discord_id):
|
||||||
|
return idx + 3 # +3 because header is row 2, data starts row 3, idx is 0-based
|
||||||
|
if username and str(row.get("Discord", "")).strip().lower() == username.lower():
|
||||||
|
return idx + 3
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def update_cell_for_member(
|
||||||
|
discord_id: int | None,
|
||||||
|
username: str | None,
|
||||||
|
column_name: str,
|
||||||
|
value: str,
|
||||||
|
) -> bool:
|
||||||
|
"""Write a value to a specific column for a member row.
|
||||||
|
|
||||||
|
Returns True if the write succeeded.
|
||||||
|
"""
|
||||||
|
ws = _worksheet or _get_worksheet()
|
||||||
|
row_idx = _row_index_for_member(discord_id=discord_id, username=username)
|
||||||
|
if row_idx is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
col_idx = EXPECTED_HEADERS.index(column_name) + 1
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
ws.update([[value]], gspread.utils.rowcol_to_a1(row_idx, col_idx),
|
||||||
|
value_input_option="USER_ENTERED")
|
||||||
|
|
||||||
|
# Keep cache in sync
|
||||||
|
cache_idx = row_idx - 3
|
||||||
|
if 0 <= cache_idx < len(_cache):
|
||||||
|
_cache[cache_idx][column_name] = value
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def batch_set_synced(updates: list[tuple[int, bool]]) -> None:
|
||||||
|
"""Batch-write 'Discordis synced?' for multiple members in a single API call."""
|
||||||
|
ws = _worksheet or _get_worksheet()
|
||||||
|
col_idx = EXPECTED_HEADERS.index("Discordis synced?") + 1
|
||||||
|
cells = []
|
||||||
|
for discord_id, synced in updates:
|
||||||
|
row_idx = _row_index_for_member(discord_id=discord_id)
|
||||||
|
if row_idx is None:
|
||||||
|
continue
|
||||||
|
cells.append(gspread.Cell(row_idx, col_idx, "TRUE" if synced else "FALSE"))
|
||||||
|
cache_idx = row_idx - 3
|
||||||
|
if 0 <= cache_idx < len(_cache):
|
||||||
|
_cache[cache_idx]["Discordis synced?"] = "TRUE" if synced else "FALSE"
|
||||||
|
if cells:
|
||||||
|
ws.update_cells(cells, value_input_option="USER_ENTERED")
|
||||||
|
|
||||||
|
|
||||||
|
def set_user_id(username: str, discord_id: int) -> bool:
|
||||||
|
"""Write a Discord user ID for a row matched by Discord username."""
|
||||||
|
return update_cell_for_member(
|
||||||
|
discord_id=None,
|
||||||
|
username=username,
|
||||||
|
column_name="User ID",
|
||||||
|
value=str(discord_id),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def set_synced(discord_id: int, synced: bool) -> bool:
|
||||||
|
"""Mark a member as synced (TRUE) or not (FALSE)."""
|
||||||
|
return update_cell_for_member(
|
||||||
|
discord_id=discord_id,
|
||||||
|
username=None,
|
||||||
|
column_name="Discordis synced?",
|
||||||
|
value="TRUE" if synced else "FALSE",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_username(discord_id: int, new_username: str) -> bool:
|
||||||
|
"""Update the Discord column for a member (keeps sheet in sync with Discord)."""
|
||||||
|
return update_cell_for_member(
|
||||||
|
discord_id=discord_id,
|
||||||
|
username=None,
|
||||||
|
column_name="Discord",
|
||||||
|
value=new_username,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def add_new_member_row(username: str, discord_id: int) -> None:
|
||||||
|
"""Append a new row to the sheet with Discord username and User ID pre-filled.
|
||||||
|
|
||||||
|
All other columns are left empty for manual entry by an admin.
|
||||||
|
"""
|
||||||
|
ws = _worksheet or _get_worksheet()
|
||||||
|
row = [""] * len(EXPECTED_HEADERS)
|
||||||
|
row[EXPECTED_HEADERS.index("Discord")] = username
|
||||||
|
row[EXPECTED_HEADERS.index("User ID")] = str(discord_id)
|
||||||
|
row[EXPECTED_HEADERS.index("Discordis synced?")] = "FALSE"
|
||||||
|
ws.append_row(row, value_input_option="USER_ENTERED")
|
||||||
|
# Add to local cache so subsequent find_member() calls work in the same session
|
||||||
|
new_entry = {h: row[i] for i, h in enumerate(EXPECTED_HEADERS)}
|
||||||
|
_cache.append(new_entry)
|
||||||
1013
strings.py
Normal file
1013
strings.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user