A Go service that polls the World of Warships API hourly, tracks player and clan statistics, and feeds data into InfluxDB, Elasticsearch, and PostgreSQL for dashboards and Discord alerts.
Discord Bot (Node.js) wows-poller (Go)
/wows_track → Postgres ←→ Hourly tick → WoWS API
LISTEN pg_notify → InfluxDB (metrics)
→ Discord alerts → Elasticsearch (events)
→ Postgres (state + alerts)
The poller and bot share a Postgres database. The poller writes data; the bot listens for changes via pg_notify and fires Discord alerts.
- Go 1.25+
- PostgreSQL
- InfluxDB 3 Core
- Elasticsearch 7.x+
- A World of Warships API application ID
git clone https://github.com/darkmukke/wows-poller
cd wows-poller
go mod downloadCopy .env.example to .env and fill in the values:
# Postgres — pgx key-value format (no URL encoding needed)
POSTGRES_DSN="host=localhost port=5432 dbname=yourdb user=wows_poller password=yourpassword sslmode=disable"
# golang-migrate requires URL format
MIGRATION_DSN="postgres://wows_poller:yourpassword@localhost:5432/yourdb?sslmode=disable"
# InfluxDB 3
INFLUX_URL=http://localhost:8182
INFLUX_TOKEN=apiv3_yourtoken
INFLUX_DB=wows
# Elasticsearch
ELASTIC_ADDRESSES=http://localhost:9200
ELASTIC_PREFIX=wows
ELASTIC_USERNAME=wows_poller
ELASTIC_PASSWORD=yourpassword
# WoWS API
WOWS_APP_ID=your_application_id
WOWS_REGION=euSupported regions: eu, na, asia
Run migrations before first use:
wows-poller migrateMigrations are in migrations/ and run automatically on serve as well.
wows-poller [command]
Commands:
serve Start the hourly poller
migrate Run database migrations
track player Track a player
track clan Track a clan and all its members
untrack player Stop tracking a player
untrack clan Stop tracking a clan
list players List all tracked players
list clans List all tracked clans
wows-poller track player <accountId> <guildId>
wows-poller track player 577479302 123456789Tracking a clan automatically tracks all current members as clan_auto. Members who leave the clan are automatically untracked unless they were manually added.
wows-poller track clan <clanId> <guildId>
wows-poller track clan 500156148 123456789wows-poller list playersACCOUNT_ID REGION TRACK_SHIPS
577479302 eu false
547900642 eu false
total: 2
The Discord bot (wows-bot.js) registers these commands — requires Administrator permission:
| Command | Description |
|---|---|
/wows_track |
Track a player or clan via wows-numbers.com URL |
/wows_untrack |
Stop tracking a player or clan |
/wows_list_players |
List tracked players with stats |
/wows_list_clans |
List tracked clans with member counts |
Commands accept wows-numbers.com URLs directly:
https://wows-numbers.com/player/577479302,D_rkM_kk_/
https://wows-numbers.com/clan/500156148,YEETD-YEETD-FLEET/
- PvP stats: battles, wins, losses, XP, damage, frags, ships spotted, planes killed
- Weapon breakdown: main battery, torpedoes, secondary battery hit rates
- Personal records: max XP, max damage, max frags per battle
- Written every hour per tracked player
- Clan membership changes (joined, left, role changed)
- Nickname changes
- Profile visibility changes (hidden/visible)
- New personal records
- Latest player snapshot for diffing
- Tracked player and clan registry
- Pending alerts queue
- Ship encyclopedia (name, tier, type, images)
- Clan membership roster
| Alert | Fires at |
|---|---|
clan_left |
Immediately — poaching window shown as Discord timestamp (3 days) |
clan_joined |
After next full tick (once nickname is resolved) |
clan_role_changed |
After next full tick |
nickname_changed |
After next full tick |
profile_hidden |
After next full tick |
profile_visible |
After next full tick |
new_record |
After next full tick |
# production
docker compose up -d --build
# view logs
docker compose logs -f wows-poller
# rebuild after code changes
docker compose up -d --build --force-recreatedocker-compose.yaml expects .env.production in the project root.
wows-poller/
├── cmd/
│ └── poller/
│ ├── main.go entry point
│ ├── root.go cobra root command + config init
│ ├── serve.go hourly poller loop
│ ├── track.go track player/clan commands
│ ├── untrack.go untrack player/clan commands
│ ├── list.go list commands
│ └── migrations.go migration runner
├── internal/
│ ├── config/ environment variable config
│ ├── notify/ pg_notify LISTEN/NOTIFY
│ ├── poller/ tick loop, diff logic, mappers
│ ├── store/
│ │ ├── elastic/ Elasticsearch event writes
│ │ ├── influx/ InfluxDB 3 metric writes
│ │ └── postgres/ player state, alerts, clans, ships
│ └── wows/ WoWS API client and types
├── migrations/ SQL migration files (.up.sql)
├── sample/ sample API response JSON files
├── Dockerfile
├── docker-compose.yaml
└── .env.example
Connect three datasources:
| Datasource | Type | Used for |
|---|---|---|
| InfluxDB 3 | InfluxDB (SQL) | Player metrics over time |
| Elasticsearch | Elasticsearch | Event log, annotations |
| PostgreSQL | PostgreSQL | Player/clan lookups, ship names |
Dashboard variables:
account_id— player selector (Postgres query, shows[CLAN] nickname)clan_id— clan selector (Postgres query)ship_id— ship selector (Postgres query, showsT7 Mahan (Destroyer))
The bot uses a feature schema system — tables prefixed with wows_ are required for the WoWS feature. If these tables are missing the bot disables WoWS commands gracefully. Required tables:
wows_tracked_playerswows_tracked_clanswows_player_statewows_pending_alertswows_clanswows_clan_memberswows_shipswows_guild_settings
MIT