Dxcufgb's Workshop

Discord Integration

Discord bot for a self-hosted Foundry VTT server.

The demo video for Discord Integration is not out yet.

See all module videos on YouTube

Discord Integration is a free, open-source Discord bot for Foundry VTT.

FoundryVTT Discord integration logo

A small Discord bot that watches a Foundry VTT v13 server running on the same machine and tells your Discord server what is going on.

Foundry VTT: v13 · Node.js: 20 or newer · Discord: slash commands, no message content access needed

Installation

You need a Discord application and bot first; see Discord Application Setup.

On Linux, on the machine that runs Foundry:

curl -fsSL https://raw.githubusercontent.com/dxcufgb/install/main/install.sh | sudo bash -s foundryvtt-discord-integration

On Windows, run foundryvtt-discord-integration-setup.exe from the latest release.

Installer options, the manual download and automatic updates: Install on Linux and Install on Windows in the wiki. Running from source: Configuration Reference.

Features

  • Discord Application Setup: Before installing, create a Discord application and bot at <https://discord.com/developers/applications> (the Discord Developer Portal).
  • Install on Linux: You need the Application ID and bot token from Discord Application Setup first.
  • Install on Windows: You need the Application ID and bot token from Discord Application Setup first.
  • Messages and Channels: The bot posts five types of message:
  • Commands: Everything is configured from Discord with slash commands.
  • Campaigns and Sessions: Campaigns bind Discord users to worlds: each campaign belongs to one Discord server, is connected to exactly one Foundry world and has exactly one DM; any number of server members can be its players, and a member can be in any number of campaigns.
  • Session Summaries: After a played session, the bot can post a short session summary to the campaign's channel.
  • Package Updates and Modules: The updates message is posted when Foundry itself, an installed system or an installed module changes version (also newly installed and removed packages, if wanted).
  • Admin Page: An optional, password-protected web page, like the admin pages of the Foundry world backup and the release proxy, shows the bot's state and changes its settings without Discord:
  • Automatic Updates: Opt-in, off by default: both installers offer to check GitHub once a day and install a newer release the same way as a manual upgrade, keeping .env and the data folder.
  • Configuration Reference: All settings are environment variables, read from .env (see .env.example):
  • How It Works: See the Configuration Reference for FOUNDRY_URL, FOUNDRY_DATA_PATH, POLL_INTERVAL_SECONDS, DOWN_AFTER_FAILURES and BOT_DATA_DIR.

Documentation

The full Discord Integration guide: overview.

Changelog

  1. 1.7.0

    Added

    • Add or remove dates of an open planning poll. A new Edit dates button under the poll lets the campaign's DM, members of the game master role (/gm-role) and server administrators change the candidate dates after the poll is posted: a private menu shows the poll's dates already selected next to the upcoming days. Votes for removed dates are dropped, and the poll message is updated without tagging anyone again.
  2. 1.6.6

    Changed

    • A world opened early still tells the players when the session is near. When the campaign's world is already running 30 minutes before a planned session, the "world is ready to join" message (which tags the players) is now sent at that point. Before, a world opened more than 30 minutes ahead never sent it. It goes out once per session, and not again if the world was started within the 30 minutes.
  3. 1.6.5

    Security

    • The administration page's plain-HTTP redirect no longer trusts the Host header. A plain-HTTP request on the HTTPS port is redirected to https:// only for a host name the page accepts anyway (ADMIN_HOSTS, localhost, this machine's names and addresses); any other name gets "400 use https://" instead of a redirect to that name.
    • A crafted checksum file can no longer stall the auto-updater. Reading SHA256SUMS.txt took seconds per line on a line with a long run of spaces; it is now linear.
    • npm run check-config no longer keeps its "password set / not set" note in a variable named like a password, so code scanning does not report it as a logged secret (the hash was never printed).
  4. 1.6.4

    Changed

    • Opening a world only pings the players when a session is about to start. The "world is ready to join" message, which tags every player of the campaigns bound to the world, is now sent only when the campaign's next session starts within 30 minutes or is already under way. Opening the world at any other time (preparation, testing) no longer pings anyone; the plain "World started" announcement is unchanged.
  5. 1.6.3

    Security

    • A flood of failed logins can no longer lock the administrator out of the administration page. After 50 failed logins from any addresses within 15 minutes the page refused every login, including the right password, so anyone who could reach the port could keep the real administrator out. Wrong passwords are still refused during such a flood and an address is still locked out for five minutes after five wrong passwords, but the right password now always gets in.
    • Manifest lookups stay off the local network. When foundryvtt.com does not know an installed package, the bot fetches the manifest URL from the package's module.json. A package could point that at a local, private or cloud-metadata address (localhost, 10.x, 192.168.x, 169.254.169.254, …); such URLs are now skipped.
    • World ids are checked before they become a path. Looking up a world's title refuses an id that is ., .. or contains anything but letters, digits, ., - and _, so an id can never point outside Data/worlds.
    • The LevelDB reader refuses absurd block sizes. A damaged or crafted world database that declares a compressed block of more than 128 MB is reported as unreadable instead of the bot trying to allocate that memory.

    Added

    • The administration page has a logo and a favicon. The d20 icon is shown at the top left on every view, the login screen included, on the login card and as the browser tab's icon. The same icon is in assets/icon.png; the README explains how to use it as the bot's avatar.

Older Discord Integration releases on GitHub