Skip to content

Timohiho/WGModsStatistics

Repository files navigation

WGMods Tracker Bot

Tracks your WGMods statistics with Playwright and posts changes to Discord webhooks.

The reusable code is kept in the wgmods_tracker/ package folder. tracker.py is only a thin runner.

Install

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
playwright install chromium
cp config.example.json config.json

On Windows:

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
playwright install chromium
copy config.example.json config.json

Commands

python tracker.py snapshot
python tracker.py watch
python tracker.py test-webhooks

Discord webhooks

config.json has two webhook URLs:

"discord": {
  "stats_webhook_url": "",
  "announcements_webhook_url": ""
}

The stats webhook receives download, vote, visible rating, internal rating, and version changes. The changed value itself is linked to the WGMods page.

The announcements webhook receives new mod announcements and changelog/update announcements.

Announcement formats

Update/changelog:

# 🔄 Crosshair Ballistics Info `1.1`
Added the option to customize the colour of the overlay in the preferences.xml file. (Section: ballisticsCrosshairOverlay)
[Download](https://wgmods.net/7681/)
<@&1472909774919307286>

New mod:

# :new: Crosshair Ballistics Info `1.0`
Shows distance, dynamic damage, and dynamic penetration at your crosshair.
Especially useful for Deep Rifled Guns.
[Download](https://wgmods.net/7681/)
@Update Notifications

For new mods, the bot cleans the WGMods description and strips common support/Discord/Patreon lines.

Raspberry Pi systemd example

Create /etc/systemd/system/wgmods-tracker.service:

[Unit]
Description=WGMods Tracker Bot
After=network-online.target
Wants=network-online.target

[Service]
WorkingDirectory=/home/pi/wgmods_tracker_bot
ExecStart=/home/pi/wgmods_tracker_bot/.venv/bin/python tracker.py watch
Restart=always
RestartSec=30
User=pi

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl daemon-reload
sudo systemctl enable wgmods-tracker
sudo systemctl start wgmods-tracker
sudo systemctl status wgmods-tracker

Testing announcement messages

The first real snapshot intentionally does not announce every existing mod, because otherwise a fresh Raspberry Pi install could spam your announcement channel with all old mods.

To test the exact Discord announcement formatting without touching WGMods or the database, run:

python tracker.py test-announcements

This sends one sample update announcement and one sample new-mod announcement to discord.announcements_webhook_url.

To test a real new-mod announcement using live WGMods data during the first bootstrap, run for example:

python tracker.py snapshot --announce-existing --max-announcements 1

That posts only the first existing mod as a new-mod announcement. Remove --max-announcements 1 only if you intentionally want to announce every existing mod found during the snapshot.

WGMods Statistics Viewer

A reusable Tkinter desktop application for exploring the SQLite database generated by the WGMods tracker.

Features

  • Open any compatible wgmods_stats.sqlite file.
  • Search and multi-select mods.
  • Quick-select the top 5 or top 10 mods by growth.
  • Plot downloads, votes, public rating, and internal rating.
  • Choose raw snapshots, hourly, daily, or weekly aggregation.
  • Compare:
    • absolute values
    • cumulative growth
    • period-by-period change
    • percentage growth
    • indexed growth where every mod starts at 100
  • Line, step, area, and bar plots.
  • Optional smoothing, markers, legend, and compressed/log scale.
  • Built-in Matplotlib toolbar for zoom, pan, reset, and image export.
  • Summary table and CSV export.
  • Zurich timezone by default, editable in the interface.

Windows

py -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
python viewer.py

You can also pass a database path:

python viewer.py "data\wgmods_stats.sqlite"

Linux / Raspberry Pi

Tkinter is usually installed through apt:

sudo apt update
sudo apt install -y python3-tk python3-venv

Then run:

chmod +x run_linux.sh
./run_linux.sh

A desktop environment or X forwarding is required because this is a GUI program.

Recommended views

To compare large and small mods fairly:

  • Select Downloads
  • Set aggregation to Daily
  • Use Cumulative growth, Percentage growth, or Indexed growth (100)

To see daily download gains:

  • Select Downloads
  • Set aggregation to Daily
  • Use Period change
  • Choose Bar or Line

To inspect vote direction and ranking effects:

  • Select Votes, Public rating, and Internal rating
  • Use Raw snapshots or Hourly
  • Use Absolute value

Date selector

The date fields use separate year, month, and day spinboxes, so you can move across months and years directly with the arrow buttons or keyboard.

About

Tools to track your wgmods mods and view the data.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages