A Discord bot that tracks Meesman fund prices and notifies subscribed channels when changes are detected.
- Aandelen Wereldwijd Totaal (NL0013689110)
- Aandelen Verantwoorde Toekomst (NL0015000PW1)
- Written in TypeScript, runs with Bun
- Support for multiple Meesman funds via dropdown selection
- Automatic hourly price checks on Monday and Tuesday
- Notifications when fund prices change
- Shows current price, previous price, and percentage change
- Price trend chart with a price axis and a date axis, rendered as a PNG and attached to every price update and
/meesman-statusreply - Buttons under the chart to switch the period between 30 days, 90 days, one year and all time
- One-off backfill of the full price history from Meesman's own published spreadsheet, so the chart has years of history from day one
- SQLite database for persistent storage
- Slash commands with fund selection dropdowns
-
Create a Discord application at https://discord.com/developers/applications
-
Create a bot for your application and copy the token
-
Enable the following in your bot settings:
applications.commandsscope (for slash commands)
-
Copy
.env.exampleto.envand fill in your values:DISCORD_TOKEN=your_bot_token_here DISCORD_CLIENT_ID=your_client_id_here -
Install dependencies:
bun install
The chart axis labels are drawn with a system font. On a bare Linux server without any fonts installed, the chart still renders but the labels are silently left out — install a font package to avoid that:
sudo apt install fonts-dejavu-core
-
Register slash commands:
bun run register
-
Backfill the price history (optional, but recommended before first run):
bun run backfill
Without this the database starts empty and the chart only fills up as the bot runs. See Backfilling price history below.
-
Start the bot:
bun start
Or with hot reload:
bun run dev
| Script | Description |
|---|---|
bun start |
Run the bot |
bun run dev |
Run with hot reload (watch mode) |
bun run register |
Register slash commands |
bun run backfill |
Import the full price history from Meesman's spreadsheet |
bun run build |
Bundle for Node.js deployment |
The bot only records prices while it is running, so a fresh database has nothing
to chart. Meesman publishes every trading price since 2015 as a spreadsheet
linked from its fund pages, and bun run backfill imports it:
bun run backfillThat fills price_history with the weekly trading prices for both funds — back
to September 2019 for Aandelen Wereldwijd Totaal and February 2022 for Aandelen
Verantwoorde Toekomst, which is when each fund launched.
Options (note the -- separator, which passes the flag through to the script):
bun run backfill -- --dry-run # report what would be imported, write nothing
bun run backfill -- --fonds=wereldwijd # import one fund onlyWorth knowing:
- It is safe to re-run. Dates already in the database are skipped, never overwritten, so prices the bot recorded live keep their original fetch time. Re-running after a few months tops up whatever is missing.
- The spreadsheet link is discovered at runtime by reading it off the fund
page, because it lives under a generated
/media/<id>/path that changes whenever Meesman republishes the file. - Dividend payouts are skipped. They sit in the same columns as the prices and are distinguished only by being coloured red, which the importer detects by resolving the cell's font colour.
- Prices are weekly, so a 30-day chart is built from roughly four points.
- If Meesman changes the spreadsheet layout the import fails loudly with what it could not find, rather than writing partial or wrong data.
All commands include a fund selection dropdown to choose which fund to interact with.
| Command | Description |
|---|---|
/meesman-follow |
Subscribe current channel to price updates for a fund |
/meesman-unfollow |
Unsubscribe current channel from price updates for a fund |
/meesman-status |
Get current fund price, statistics, and check for updates |
/meesman-history |
Show recent price history for a fund |
The bot automatically checks for price updates for all supported funds every hour on Monday and Tuesday (Europe/Amsterdam timezone). This schedule aligns with when Meesman typically updates their fund prices.
All data is stored in an SQLite database at data/meesman.db:
- subscriptions: Channels that receive price update notifications
- price_history: Historical price data for tracking changes, populated live
by the bot and in bulk by
bun run backfill
The bot runs on Linux using screen for process management:
# Start a new screen session
screen -S meesman
# Install dependencies and start the bot
bun install && bun start
# Detach from session: Ctrl+A, then DTo reattach later:
screen -r meesmanIf it says "attached" elsewhere, force reattach:
screen -d -r meesmanAfter pulling new code, reattach to the screen session, stop the bot with Ctrl+C, then run bun install && bun start again.
Generate an invite link with the following permissions:
View ChannelsSend MessagesEmbed LinksAttach Files(required for the price trend chart)Use Application Commands
Example invite URL format:
https://discord.com/api/oauth2/authorize?client_id=1460663524106829966&permissions=2147535872&scope=bot%20applications.commands