Skip to content

eryon/discord-to-fvtt

Repository files navigation

Discord to FoundryVTT

Supported FVTT

This FoundryVTT module is designed to push messages from Discord to the game chat log. It runs only when the game is also running, and will not collect or synchronize messages offline.

The module will forward all messages from all channels it has access to. You can assign the bot a role and manage its permissions through the Discord server interface.

A GM user needs to be logged in for the Discord connection to remain active.

Module Settings

Discord Server ID

Enter your Discord server ID, which you can find as described here.

Discord Channel IDs

Enter a list of comma-separated Discord channel IDs, as described here. The bot will only relay messages from these channels.

If this field is blank, the bot will relay messages from all channels it has access to.

Discord Token

Enter your Discord bot token here. See below for details on setting up your bot.

Preserve Messages

When messages are deleted in Discord, you can optionally preserve them in the chatlog. If this setting is enabled, deleted messages will still be in the chat log but the content will have a strikethrough to indicate its status.

Setting Up

Discord Bot

You are responsible for setting up your own Discord bot, as described below. You can assign a role or channel permissions to the bot through the Discord server interface to restrict which channels it can observe.

Creating a Bot

Here's how to set up a basic Discord bot for this module's purpose:

  1. Open the Discord developer portal and log in to your account
  2. Click on the "New Application" button
  3. Enter a name and confirm the pop-up window by clicking the "Create" button
  4. On the left, click on the "Installation" menu and adjust the settings (see figure 1 below)
    1. Turn off "User Install"
    2. Add the "bot" scope and the "Read Message History" permission
    3. Copy the provided "Install Link"
  5. On the left sidebar, click on the "Bot" menu
    1. Click on the "Reset Token" button and copy the resulting token. KEEP THIS VALUE SECRET!
    2. Scroll down and ENABLE the special permissions:
      1. "Presence Intent" to allow the bot to read user nicknames
      2. "Message Content Intent" to allow the bot to read messages
  6. Open the install link from 4(iii) and authorize the bot to your server
  7. Open your FoundryVTT game and input the token from step 5(i) for this module's "Discord Token" setting

figure-1

Figure 1 - Bot Install

Roadmap - Planned Features

  • Markdown formatting: apply markdown formatting to the message to imitate Discord's styling
  • Whispers: make a hook to mimic DMs as whispers