Bots¶
Purpose¶
The Bots screen configures the casino "house bots" — synthetic accounts that bet alongside real players to inflate live activity displays, populate leaderboards on slow days, and stress-test new game launches. Bots are an intentional engagement feature, not a fraud surface; the related online-counter inflation is documented in project_online_count_inflation memory.
Audience¶
Marketing / engagement (configures presence patterns), engineering (tunes wager curves), risk (audits to ensure bots aren't accidentally credited or eligible for promos).
Path in admin-fe¶
| Screen | URL | Page |
|---|---|---|
| Bots list / config | /bots |
ebit-admin-fe/src/app/(dashboard)/bots/page.tsx |
Backing API endpoints¶
| Endpoint | Source |
|---|---|
GET /admin/bot-activity/all (paginated list) |
apps/api/src/bots/bot.controller.ts:27 |
GET /admin/bot-activity/one/:id |
apps/api/src/bots/bot.controller.ts:33 |
POST /admin/bot-activity/manage (create / upsert) |
apps/api/src/bots/bot.controller.ts:39 |
PATCH /admin/bot-activity/manage (update) |
apps/api/src/bots/bot.controller.ts:45 |
PATCH /admin/bot-activity/bot-toggle (mark a User as bot) |
apps/api/src/bots/bot.controller.ts:51 |
Frontend wiring: ebit-admin-fe/src/queries/bots/index.ts.
Key actions¶
| Action | Required permission | API call | DB tables touched | Audit-logged? |
|---|---|---|---|---|
| List bots | casino-bot.view |
GET /admin/bot-activity/all |
User (where isBot=true), bot config |
yes |
| Get one bot | casino-bot.view |
GET /admin/bot-activity/one/:id |
same | yes |
| Create / upsert bot config | casino-bot.management |
POST /admin/bot-activity/manage |
bot config table, User |
yes |
| Update bot config | casino-bot.management |
PATCH /admin/bot-activity/manage |
same | yes |
| Toggle a user as bot | casino-bot.management |
PATCH /admin/bot-activity/bot-toggle |
User.isBot |
yes |
The actual bot runtime (which schedules synthetic bets) is in apps/api/src/bots/system/bull/ and rides BullMQ — outside the admin screen surface. The admin screen only manages config records.
Filters and views¶
- Status — active / paused.
- Game — bots are typically configured per-game (slots, plinko, roulette).
- Wager profile — small / medium / whale (preset curves).
- Currency — bots play in USDT / BTC / ETH per config.
Common workflows¶
- Launch a new game with bot presence. Engineering or marketing creates a few bot configs targeting the new game slug. Sets wager profile = small, currency = USDT, schedule = 2 bets/min during peak hours. Bot runtime picks up new config on next BullMQ enqueue cycle.
- Pause bots during an incident. During a payment / RT outage, ops pause all bots (toggle
active=falseon each config) so synthetic activity doesn't pollute incident telemetry. - Audit bot footprint. Risk filters all bots, exports list. Cross-references with bets-history.md — bot bets carry
User.isBot=trueflag, so they're excluded from public stats / leaderboards. - Convert a sample test account into a bot. Engineering toggles
User.isBot=trueviaPATCH /admin/bot-activity/bot-toggle. The user immediately stops appearing in player-facing widgets (leaderboard, online count basis). - Tune the online floor.
fakeUserOnlinefloor (180-500) is hard-coded in theUsersOnlineUpdatedbroadcast logic, not configured here. To change it, deploy code — seeproject_online_count_inflation.
Edge cases / gotchas¶
- Bots have real DB user records. They sit in the
Usertable withisBot=true. Don'tDELETE— toggle inactive instead. - Bot bets DO show up in the bets-history listing unless filtered. Default Bets page shows real users only because the
User.isBot=truefilter is applied client-side. - Bot wins / losses still hit accounting tables. They have isolated bot-pool accounts; finance ignores them in P&L. If a bot is mis-configured (
isBot=false), it can pollute real ledgers. UsersOnlineUpdatedinflation is independent. Disabling all bots does not zero the online widget — there's a separatefakeUserOnlinefloor (init 500, drift ±5, floor 180). Seeproject_online_count_inflation.- Online count broadcasts every 10 s. Tuning the broadcast cadence is in
apps/api/src/system/online-users/, not here. - No per-region bot config. Bots play in a global pool. Adding region-aware bots is a feature gap.
- Promo-code eligibility excludes bots by design. Bots set
User.isBot=truewhich is checked inapps/api/src/promo/services/promo-validator.service.ts.
Cross-links¶
- Online-count inflation memory:
project_online_count_inflation - Per-bot bets: bets-history.md
- Leaderboard exclusion: leaderboard.md
- Admin permissions for bot management:
libs/auth/src/permissions/const.ts:236-243 - Audit: admin-logs.md
Sequence — pause all bots during incident¶
sequenceDiagram
actor admin
participant admin-fe
participant api
participant pg as Postgres
participant queue as BullMQ (bot scheduler)
admin->>admin-fe: open /bots, select all, click Pause
loop for each selected bot
admin-fe->>api: PATCH /admin/bot-activity/manage { id, active: false }
api->>api: PermissionGuard('casino-bot.management')
api->>pg: UPDATE BotActivityConfig SET active=false
api->>pg: INSERT AdminActionLog
end
api-->>admin-fe: 200 per row
Note over queue: scheduler skips configs where active=false on next cycle (~30s)
admin-fe-->>admin: rows show paused